<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>bcftools</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="bcftools" lang="en"><a id="idp144160"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>bcftools — utilities for variant calling and manipulating VCFs and BCFs.</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p><span class="strong"><strong>bcftools</strong></span> [--version|--version-only] [--help] [<span class="emphasis"><em>COMMAND</em></span>] [<span class="emphasis"><em>OPTIONS</em></span>]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>BCFtools  is  a set of utilities that manipulate variant calls in the Variant
Call Format (VCF) and its binary counterpart BCF. All commands work
transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.</p><p>Most commands accept VCF, bgzipped VCF and BCF with filetype detected
automatically even when streaming from a pipe. Indexed VCF and BCF
will work in all situations. Un-indexed VCF and BCF and streams will
work in most, but not all situations. In general, whenever multiple VCFs are
read simultaneously, they must be indexed and therefore also compressed.
(Note that files with non-standard index names can be accessed as e.g.
"<code class="literal">bcftools view -r X:2928329 file.vcf.gz##idx##non-standard-index-name</code>".)</p><p>BCFtools is designed to work on a stream. It regards an input file "-" as the
standard input (stdin) and outputs to the standard output (stdout). Several
commands can thus be  combined  with  Unix pipes.</p><div class="refsect2" title="VERSION"><a id="_version"></a><h3>VERSION</h3><p>This manual page was last updated <span class="strong"><strong>2020-09-22</strong></span> and refers to bcftools git version <span class="strong"><strong>1.11</strong></span>.</p></div><div class="refsect2" title="BCF1"><a id="_bcf1"></a><h3>BCF1</h3><p>The BCF1 format output by versions of samtools &lt;= 0.1.19 is <span class="strong"><strong>not</strong></span>
compatible with this version of bcftools. To read BCF1 files one can use
the view command from old versions of bcftools packaged with samtools
versions &lt;= 0.1.19 to convert to VCF, which can then be read by
this version of bcftools.</p><pre class="screen">    samtools-0.1.19/bcftools/bcftools view file.bcf1 | bcftools view</pre></div><div class="refsect2" title="VARIANT CALLING"><a id="_variant_calling"></a><h3>VARIANT CALLING</h3><p>See <span class="emphasis"><em>bcftools call</em></span> for variant calling from the output of the
<span class="emphasis"><em>samtools mpileup</em></span> command. In versions of samtools &lt;= 0.1.19 calling was
done with <span class="emphasis"><em>bcftools view</em></span>. Users are now required to choose between the old
samtools calling model (<span class="emphasis"><em>-c/--consensus-caller</em></span>) and the new multiallelic
calling model (<span class="emphasis"><em>-m/--multiallelic-caller</em></span>). The multiallelic calling model
is recommended for most tasks.</p></div></div><div class="refsect1" title="LIST OF COMMANDS"><a id="_list_of_commands"></a><h2>LIST OF COMMANDS</h2><p>For a full list of available commands, run <span class="strong"><strong>bcftools</strong></span> without arguments. For a full
list of available options, run <span class="strong"><strong>bcftools</strong></span> <span class="emphasis"><em>COMMAND</em></span> without arguments.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<span class="strong"><strong><a class="link" href="#annotate" title="bcftools annotate [OPTIONS] FILE">annotate</a></strong></span>   .. edit VCF files, add or remove annotations
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#call" title="bcftools call [OPTIONS] FILE">call</a></strong></span>        ..  SNP/indel calling (former "view")
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#cnv" title="bcftools cnv [OPTIONS] FILE">cnv</a></strong></span>          ..  Copy Number Variation caller
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#concat" title="bcftools concat [OPTIONS] FILE1 FILE2 […]">concat</a></strong></span>    ..  concatenate VCF/BCF files from the same set of samples
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#consensus" title="bcftools consensus [OPTIONS] FILE">consensus</a></strong></span>    ..  create consensus sequence by applying VCF variants
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#convert" title="bcftools convert [OPTIONS] FILE">convert</a></strong></span>  ..  convert VCF/BCF to other formats and back
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#csq" title="bcftools csq [OPTIONS] FILE">csq</a></strong></span>          ..  haplotype aware consequence caller
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#filter" title="bcftools filter [OPTIONS] FILE">filter</a></strong></span>    ..  filter VCF/BCF files using fixed thresholds
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#gtcheck" title="bcftools gtcheck [OPTIONS] [-g genotypes.vcf.gz] query.vcf.gz">gtcheck</a></strong></span>  ..  check sample concordance, detect sample swaps and contamination
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#index" title="bcftools index [OPTIONS] in.bcf|in.vcf.gz">index</a></strong></span>      ..  index VCF/BCF
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#isec" title="bcftools isec [OPTIONS] A.vcf.gz B.vcf.gz […]">isec</a></strong></span>        ..  intersections of VCF/BCF files
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#merge" title="bcftools merge [OPTIONS] A.vcf.gz B.vcf.gz […]">merge</a></strong></span>      ..  merge VCF/BCF files files from non-overlapping sample sets
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#mpileup" title="bcftools mpileup [OPTIONS] -f ref.fa in.bam [in2.bam […]]">mpileup</a></strong></span>  ..  multi-way pileup producing genotype likelihoods
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#norm" title="bcftools norm [OPTIONS] file.vcf.gz">norm</a></strong></span>        ..  normalize indels
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#plugin" title="bcftools [plugin NAME|+NAME] [OPTIONS] FILE — [PLUGIN OPTIONS]">plugin</a></strong></span>    ..  run user-defined plugin
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#polysomy" title="bcftools polysomy [OPTIONS] file.vcf.gz">polysomy</a></strong></span>   ..  detect contaminations and whole-chromosome aberrations
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#query" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]">query</a></strong></span>      ..  transform VCF/BCF into user-defined formats
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#reheader" title="bcftools reheader [OPTIONS] file.vcf.gz">reheader</a></strong></span>   ..  modify VCF/BCF header, change sample names
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#roh" title="bcftools roh [OPTIONS] file.vcf.gz">roh</a></strong></span>          ..  identify runs of homo/auto-zygosity
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#sort" title="bcftools sort [OPTIONS] file.bcf">sort</a></strong></span>        ..  sort VCF/BCF files
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">stats</a></strong></span>      ..  produce VCF/BCF stats (former vcfcheck)
</li><li class="listitem">
<span class="strong"><strong><a class="link" href="#view" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]">view</a></strong></span>        ..  subset, filter and convert VCF and BCF files
</li></ul></div></div><div class="refsect1" title="LIST OF SCRIPTS"><a id="_list_of_scripts"></a><h2>LIST OF SCRIPTS</h2><p>Some helper scripts are bundled with the bcftools code.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<span class="strong"><strong><a class="link" href="#plot-vcfstats" title="plot-vcfstats [OPTIONS] file.vchk […]">plot-vcfstats</a></strong></span>  .. plots the output of <span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">stats</a></strong></span>
</li></ul></div></div><div class="refsect1" title="COMMANDS AND OPTIONS"><a id="_commands_and_options"></a><h2>COMMANDS AND OPTIONS</h2><div class="refsect2" title="Common Options"><a id="common_options"></a><h3>Common Options</h3><p>The following options are common to many bcftools commands. See usage for
specific commands to see if they apply.</p><div class="variablelist"><dl><dt><span class="term">
<span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Files can be both VCF or BCF, uncompressed or BGZF-compressed. The file "-"
    is interpreted as standard input. Some tools may require tabix- or
    CSI-indexed files.
</dd><dt><span class="term">
<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>|<span class="emphasis"><em>id</em></span>
</span></dt><dd><p class="simpara">
    Controls  how to treat records with duplicate positions and defines compatible
    records across multiple input files. Here by "compatible" we mean records which
    should be considered as identical by the tools. For example, when performing
    line intersections, the desire may be to consider as identical all sites with
    matching positions (<span class="strong"><strong>bcftools isec -c</strong></span> <span class="emphasis"><em>all</em></span>), or only sites with  matching variant
    type (<span class="strong"><strong>bcftools isec -c</strong></span> <span class="emphasis"><em>snps</em></span>  <span class="strong"><strong>-c</strong></span> <span class="emphasis"><em>indels</em></span>), or only sites with all alleles
    identical (<span class="strong"><strong>bcftools isec -c</strong></span> <span class="emphasis"><em>none</em></span>).
</p><div class="variablelist"><dl><dt><span class="term">
<span class="emphasis"><em>none</em></span>
</span></dt><dd>
            only records with identical REF and ALT alleles are compatible
</dd><dt><span class="term">
<span class="emphasis"><em>some</em></span>
</span></dt><dd>
            only records where some subset of ALT alleles match are compatible
</dd><dt><span class="term">
<span class="emphasis"><em>all</em></span>
</span></dt><dd>
            all records are compatible, regardless of whether the ALT alleles
            match or not. In the case of records with the same position, only
            the first will be considered and appear on output.
</dd><dt><span class="term">
<span class="emphasis"><em>snps</em></span>
</span></dt><dd>
            any SNP records are compatible, regardless of whether the ALT
            alleles match or not. For duplicate positions, only the first SNP
            record will be considered and appear on output.
</dd><dt><span class="term">
<span class="emphasis"><em>indels</em></span>
</span></dt><dd>
            all  indel records are compatible, regardless of whether the REF
            and ALT alleles match or not. For duplicate positions, only the
            first indel record will be considered and appear on output.
</dd><dt><span class="term">
<span class="emphasis"><em>both</em></span>
</span></dt><dd>
            abbreviation of "<span class="strong"><strong>-c</strong></span> <span class="emphasis"><em>indels</em></span>  <span class="strong"><strong>-c</strong></span> <span class="emphasis"><em>snps</em></span>"
</dd><dt><span class="term">
<span class="emphasis"><em>id</em></span>
</span></dt><dd>
            only records with identical ID column are compatible.
            Supported by <span class="strong"><strong><a class="link" href="#merge" title="bcftools merge [OPTIONS] A.vcf.gz B.vcf.gz […]">bcftools merge</a></strong></span> only.
</dd></dl></div></dd><dt><span class="term">
<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    Skip sites where FILTER column does not contain any of the strings listed
    in <span class="emphasis"><em>LIST</em></span>. For example, to include only sites which have no filters set,
    use <span class="strong"><strong>-f</strong></span> <span class="emphasis"><em>.,PASS</em></span>.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    Do not append version and command line information to the output VCF header.
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    When output consists of a single stream, write it to <span class="emphasis"><em>FILE</em></span> rather than
    to standard output, where it is written by default.
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    Output compressed BCF (<span class="emphasis"><em>b</em></span>), uncompressed BCF (<span class="emphasis"><em>u</em></span>), compressed VCF (<span class="emphasis"><em>z</em></span>), uncompressed VCF (<span class="emphasis"><em>v</em></span>).
    Use the -Ou option when piping between bcftools subcommands to speed up
    performance by removing unnecessary compression/decompression and
    VCF←→BCF conversion.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:beg-end</em></span>|<span class="emphasis"><em>chr:beg-</em></span>[,…]
</span></dt><dd>
    Comma-separated list of regions, see also <span class="strong"><strong>-R, --regions-file</strong></span>. Overlapping
    records are matched even when the starting coordinate is outside of the
    region, unlike the <span class="strong"><strong>-t/-T</strong></span> options where only the POS coordinate is checked.
    Note that <span class="strong"><strong>-r</strong></span> cannot be used in combination with <span class="strong"><strong>-R</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Regions can be specified either on command line or in a VCF, BED, or
    tab-delimited file (the default). The columns of the tab-delimited file
    can contain either positions (two-column format) or intervals (three-column
    format): CHROM, POS, and, optionally, END,  where positions are 1-based
    and inclusive. The columns of the tab-delimited BED file are also
    CHROM, POS and END (trailing columns are ignored), but coordinates
    are 0-based, half-open.  To indicate that a file be treated as BED rather
    than the 1-based tab-delimited file, the file must have the ".bed" or
    ".bed.gz" suffix (case-insensitive). Uncompressed files are stored in
    memory, while bgzip-compressed and tabix-indexed region files are streamed.
    Note that sequence names must match exactly, "chr20" is not the same as
    "20".  Also note that chromosome ordering in <span class="emphasis"><em>FILE</em></span> will be respected,
    the VCF will be processed in the order in which chromosomes first appear
    in <span class="emphasis"><em>FILE</em></span>. However, within chromosomes, the VCF will always be
    processed in ascending genomic coordinate order no matter what order they
    appear in <span class="emphasis"><em>FILE</em></span>. Note that overlapping regions in <span class="emphasis"><em>FILE</em></span> can result in
    duplicated out of order positions in the output.
    This option requires indexed VCF/BCF files. Note that <span class="strong"><strong>-R</strong></span> cannot be used
    in combination with <span class="strong"><strong>-r</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> [^]<span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    Comma-separated list of samples to include or exclude if prefixed
    with "^".
    The sample order is updated to reflect that given on the command line.
    Note that in general tags such as INFO/AC, INFO/AN, etc are not updated
    to correspond to the subset samples. <span class="strong"><strong><a class="link" href="#view" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]">bcftools view</a></strong></span> is the
    exception where some tags will be updated (unless the <span class="strong"><strong>-I, --no-update</strong></span>
    option is used; see <span class="strong"><strong><a class="link" href="#view" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]">bcftools view</a></strong></span> documentation). To use updated
    tags for the subset in another command one can pipe from <span class="strong"><strong>view</strong></span> into
    that command. For example:
</dd></dl></div><pre class="screen">    bcftools view -Ou -s sample1,sample2 file.vcf | bcftools query -f %INFO/AC\t%INFO/AN\n</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em><span class="^">FILE</span></em></span><a id="samples_file"></a>
</span></dt><dd>
    File of sample names to include or exclude if prefixed with "^".
    One sample per line. See also the note above for the <span class="strong"><strong>-s, --samples</strong></span>
    option.
    The sample order is updated to reflect that given in the input file.
    The command <span class="strong"><strong><a class="link" href="#call" title="bcftools call [OPTIONS] FILE">bcftools call</a></strong></span> accepts an optional second
    column indicating ploidy (0, 1 or 2) or sex (as defined by
    <span class="strong"><strong><a class="link" href="#ploidy">--ploidy</a></strong></span>, for example "F" or "M"), for example:
</dd></dl></div><pre class="screen">    sample1    1
    sample2    2
    sample3    2</pre><p>or</p><pre class="screen">    sample1    M
    sample2    F
    sample3    F</pre><p>If the second column is not present, the sex "F" is assumed.
With <span class="strong"><strong><a class="link" href="#call" title="bcftools call [OPTIONS] FILE">bcftools call</a> -C</strong></span> <span class="emphasis"><em>trio</em></span>, PED file is expected.
The program ignores the first column and the last indicates sex (1=male, 2=female), for example:</p><pre class="screen">    ignored_column  daughterA fatherA  motherA  2
    ignored_column  sonB      fatherB  motherB  1</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> [^]<span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    Similar as <span class="strong"><strong>-r, --regions</strong></span>, but the next position is accessed by streaming the
    whole VCF/BCF rather than using the tbi/csi index. Both <span class="strong"><strong>-r</strong></span> and <span class="strong"><strong>-t</strong></span> options
    can be applied simultaneously: <span class="strong"><strong>-r</strong></span>  uses  the index  to  jump  to  a  region
    and <span class="strong"><strong>-t</strong></span> discards positions which are not in the targets. Unlike <span class="strong"><strong>-r</strong></span>, targets
    can be prefixed with "^" to request logical complement. For example, "^X,Y,MT"
    indicates that sequences X, Y and MT should be skipped.
    Yet another difference between the <span class="strong"><strong>-t/-T</strong></span> and <span class="strong"><strong>-r/-R</strong></span> is that <span class="strong"><strong>-r/-R</strong></span> checks for
    proper overlaps and considers both POS and the end position of an indel, while <span class="strong"><strong>-t/-T</strong></span>
    considers the POS coordinate only. Note that <span class="strong"><strong>-t</strong></span> cannot be used in combination with <span class="strong"><strong>-T</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> [^]<span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Same <span class="strong"><strong>-t, --targets</strong></span>, but reads regions from a file. Note that <span class="strong"><strong>-T</strong></span>
    cannot be used in combination with <span class="strong"><strong>-t</strong></span>.
</dd><dt><span class="term">
 
</span></dt><dd>
    With the <span class="strong"><strong>call -C</strong></span> <span class="emphasis"><em>alleles</em></span> command, third column of the targets file must
    be comma-separated list of alleles, starting with the reference allele.
    Note that the file must be compressed and index.
    Such a file can be easily created from a VCF using:
</dd></dl></div><pre class="screen">    bcftools query -f'%CHROM\t%POS\t%REF,%ALT\n' file.vcf | bgzip -c &gt; als.tsv.gz &amp;&amp; tabix -s1 -b2 -e2 als.tsv.gz</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Use multithreading with <span class="emphasis"><em>INT</em></span> worker threads. The option is currently used only for the compression of the
    output stream, only when <span class="emphasis"><em>--output-type</em></span> is <span class="emphasis"><em>b</em></span> or <span class="emphasis"><em>z</em></span>. Default: 0.
</dd></dl></div></div><div class="refsect2" title="bcftools annotate [OPTIONS] FILE"><a id="annotate"></a><h3>bcftools annotate <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Add or remove annotations.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-a, --annotations</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    Bgzip-compressed and tabix-indexed file with annotations. The file
    can be VCF, BED, or a tab-delimited file with mandatory columns CHROM, POS
    (or, alternatively, FROM and TO), optional columns REF and ALT, and arbitrary
    number of annotation columns. BED files are expected to have
    the ".bed" or ".bed.gz" suffix (case-insensitive), otherwise a tab-delimited file is assumed.
    Note that in case of tab-delimited file, the coordinates POS, FROM and TO are
    one-based and inclusive.  When REF and ALT are present, only matching VCF
    records will be annotated.
    When multiple ALT alleles are present in the annotation file (given as
    comma-separated list of alleles), at least one must match one of the
    alleles in the corresponding VCF record. Similarly, at least one
    alternate allele from a multi-allelic VCF record must be present in the
    annotation file.
    Missing values can be added by providing "." in place of actual value.
    Note that flag types, such as "INFO/FLAG", can be annotated by including
    a field with the value "1" to set the flag, "0" to remove it, or "." to
    keep existing flags.
    See also <span class="strong"><strong>-c, --columns</strong></span> and <span class="strong"><strong>-h, --header-lines</strong></span>.
</dd></dl></div><pre class="screen">    # Sample annotation file with columns CHROM, POS, STRING_TAG, NUMERIC_TAG
    1  752566  SomeString      5
    1  798959  SomeOtherString 6
    # etc.</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>
</span></dt><dd>
    Controls how to match records from the annotation file to the target VCF.
    Effective only when <span class="strong"><strong>-a</strong></span> is a VCF or BCF.
    See <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span> for more.
</dd><dt><span class="term">
<span class="strong"><strong>-c, --columns</strong></span> <span class="emphasis"><em>list</em></span>
</span></dt><dd>
    Comma-separated list of columns or tags to carry over from the annotation file
    (see also <span class="strong"><strong>-a, --annotations</strong></span>). If the annotation file is not a VCF/BCF,
    <span class="emphasis"><em>list</em></span> describes the columns of the annotation file and must include CHROM,
    POS (or, alternatively, FROM and TO), and optionally REF and ALT. Unused
    columns which should be ignored can be indicated by "-".
   
    If the annotation file is a VCF/BCF, only the edited columns/tags must be present and their
    order does not matter. The columns ID, QUAL, FILTER, INFO and FORMAT
    can be edited, where INFO tags can be written both as "INFO/TAG" or simply "TAG",
    and FORMAT tags can be written as "FORMAT/TAG" or "FMT/TAG".
    The imported VCF annotations can be renamed as "DST_TAG:=SRC_TAG" or "FMT/DST_TAG:=FMT/SRC_TAG".
   
    To carry over all INFO annotations, use "INFO". To add all INFO annotations except
    "TAG", use "^INFO/TAG". By default, existing values are replaced.
   
    To add annotations without overwriting existing values (that is, to add missing tags or
    add values to existing tags with missing values), use "+TAG" instead of "TAG".
    To append to existing values (rather than replacing or leaving untouched), use "=TAG"
    (instead of "TAG" or "+TAG").
    To replace only existing values without modifying missing annotations, use "-TAG".
   
    If the annotation file is not a VCF/BCF, all new annotations must be
    defined via <span class="strong"><strong>-h, --header-lines</strong></span>.
   
    See also the <span class="strong"><strong>-l, --merge-logic</strong></span> option.
</dd><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>--force</strong></span>
</span></dt><dd>
    continue even when parsing errors, such as undefined tags, are encountered. Note
    this can be an unsafe operation and can result in corrupted BCF files. If this
    option is used, make sure to sanity check the result thoroughly.
</dd><dt><span class="term">
<span class="strong"><strong>-h, --header-lines</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    Lines to append to the VCF header, see also <span class="strong"><strong>-c, --columns</strong></span> and <span class="strong"><strong>-a, --annotations</strong></span>. For example:
</dd></dl></div><pre class="screen">    ##INFO=&lt;ID=NUMERIC_TAG,Number=1,Type=Integer,Description="Example header line"&gt;
    ##INFO=&lt;ID=STRING_TAG,Number=1,Type=String,Description="Yet another header line"&gt;</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-I, --set-id</strong></span> [+]<span class="emphasis"><em>FORMAT</em></span>
</span></dt><dd>
    assign ID on the fly. The format is the same as in the <span class="strong"><strong><a class="link" href="#query" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]">query</a></strong></span>
    command (see below).  By default all existing IDs are replaced. If the
    format string is preceded by "+", only missing IDs will be set. For example,
    one can use
</dd></dl></div><pre class="screen">    bcftools annotate --set-id +'%CHROM\_%POS\_%REF\_%FIRST_ALT' file.vcf</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-k, --keep-sites</strong></span>
</span></dt><dd>
    keep sites which do not pass <span class="strong"><strong>-i</strong></span> and <span class="strong"><strong>-e</strong></span> expressions instead of discarding them
</dd><dt><span class="term">
<span class="strong"><strong>-l, --merge-logic</strong></span> <span class="emphasis"><em>tag</em></span>:'first'|<span class="emphasis"><em>append</em></span>|<span class="emphasis"><em>unique</em></span>|<span class="emphasis"><em>sum</em></span>|<span class="emphasis"><em>avg</em></span>|<span class="emphasis"><em>min</em></span>|<span class="emphasis"><em>max</em></span>[,…]
</span></dt><dd>
    if multiple regions overlap a single record, the option defines how to treat multiple
    annotation values when setting <span class="emphasis"><em>tag</em></span> in the destination file: use the first encountered value ignoring
    the rest (<span class="emphasis"><em>first</em></span>); append allowing duplicates (<span class="emphasis"><em>append</em></span>); append discarding duplicate values (<span class="emphasis"><em>unique</em></span>);
    sum the values (<span class="emphasis"><em>sum</em></span>, numeric fields only); average the values (<span class="emphasis"><em>avg</em></span>); use the minimum value (<span class="emphasis"><em>min</em></span>) or
    the maximum (<span class="emphasis"><em>max</em></span>).
   
    Note that this option is intended for use with BED or TAB-delimited annotation files only. Moreover,
    it is effective only when either <span class="emphasis"><em>REF</em></span> and <span class="emphasis"><em>ALT</em></span> or <span class="emphasis"><em>BEG</em></span> and <span class="emphasis"><em>END</em></span> <span class="strong"><strong>--columns</strong></span> are present .
   
    Multiple rules can be given either as a comma-separated list or giving the option multiple times.
    This is an experimental feature.
</dd><dt><span class="term">
<span class="strong"><strong>-m, --mark-sites</strong></span> <span class="emphasis"><em><span class="+-">TAG</span></em></span>
</span></dt><dd>
    annotate sites which are present ("+") or absent ("-") in the <span class="strong"><strong>-a</strong></span> file with a new INFO/TAG flag
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--rename-chrs</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    rename chromosomes according to the map in <span class="emphasis"><em>file</em></span>, with
    "old_name new_name\n" pairs separated by whitespaces, each on a separate
    line.
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> [^]<span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    subset of samples to annotate, see also <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    subset of samples to annotate. If the samples are named differently in the
    target VCF and the <span class="strong"><strong>-a, --annotations</strong></span> VCF, the name mapping can be
    given as "src_name dst_name\n", separated by whitespaces, each pair on a
    separate line.
</dd><dt><span class="term">
<span class="strong"><strong>--single-overlaps</strong></span>
</span></dt><dd>
    use this option to keep memory requirements low with very large annotation
    files. Note, however, that this comes at a cost, only single overlapping intervals
    are considered in this mode. This was the default mode until the commit
    af6f0c9 (Feb 24 2019).
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-x, --remove</strong></span> <span class="emphasis"><em>list</em></span>
</span></dt><dd>
    List of annotations to remove. Use "FILTER" to remove all filters or
    "FILTER/SomeFilter" to remove a specific filter. Similarly, "INFO" can
    be used to remove all INFO tags and "FORMAT" to remove all FORMAT tags
    except GT. To remove all INFO tags except "FOO" and "BAR", use
    "^INFO/FOO,INFO/BAR" (and similarly for FORMAT and FILTER).
    "INFO" can be abbreviated to "INF" and "FORMAT" to "FMT".
</dd></dl></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="screen">    # Remove three fields
    bcftools annotate -x ID,INFO/DP,FORMAT/DP file.vcf.gz

    # Remove all INFO fields and all FORMAT fields except for GT and PL
    bcftools annotate -x INFO,^FORMAT/GT,FORMAT/PL file.vcf

    # Add ID, QUAL and INFO/TAG, not replacing TAG if already present
    bcftools annotate -a src.bcf -c ID,QUAL,+TAG dst.bcf

    # Carry over all INFO and FORMAT annotations except FORMAT/GT
    bcftools annotate -a src.bcf -c INFO,^FORMAT/GT dst.bcf

    # Annotate from a tab-delimited file with six columns (the fifth is ignored),
    # first indexing with tabix. The coordinates are 1-based.
    tabix -s1 -b2 -e2 annots.tab.gz
    bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,POS,REF,ALT,-,TAG file.vcf

    # Annotate from a tab-delimited file with regions (1-based coordinates, inclusive)
    tabix -s1 -b2 -e3 annots.tab.gz
    bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,FROM,TO,TAG input.vcf

    # Annotate from a bed file (0-based coordinates, half-closed, half-open intervals)
    bcftools annotate -a annots.bed.gz -h annots.hdr -c CHROM,FROM,TO,TAG input.vcf

    # For more examples see http://samtools.github.io/bcftools/howtos/annotate.html</pre></div><div class="refsect2" title="bcftools call [OPTIONS] FILE"><a id="call"></a><h3>bcftools call <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>This command replaces the former <span class="strong"><strong>bcftools view</strong></span> caller. Some of the original
functionality has been temporarily lost in the process of transition under
<a class="ulink" href="http://github.com/samtools/htslib" target="_top">htslib</a>, but will be added back on popular
demand. The original calling model can be invoked with the <span class="strong"><strong>-c</strong></span> option.</p><div class="refsect3" title="File format options:"><a id="_file_format_options"></a><h4>File format options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--ploidy</strong></span> <span class="emphasis"><em>ASSEMBLY</em></span>[<span class="emphasis"><em>?</em></span>]<a id="ploidy"></a>
</span></dt><dd>
    predefined ploidy, use <span class="emphasis"><em>list</em></span> (or any other unused word) to print a list
    of all predefined assemblies. Append a question mark to print the actual
    definition. See also <span class="strong"><strong>--ploidy-file</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>--ploidy-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    ploidy definition given as a space/tab-delimited list of
    CHROM, FROM, TO, SEX, PLOIDY. The SEX codes are arbitrary and
    correspond to the ones used by <span class="strong"><strong><a class="link" href="#samples_file">--samples-file</a></strong></span>.
    The default ploidy can be given using the starred records (see
    below), unlisted regions have ploidy 2. The default ploidy definition is
</dd></dl></div><pre class="screen">    X 1 60000 M 1
    X 2699521 154931043 M 1
    Y 1 59373566 M 1
    Y 1 59373566 F 0
    MT 1 16569 M 1
    MT 1 16569 F 1
    *  * *     M 2
    *  * *     F 2</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="Input/output options:"><a id="_input_output_options"></a><h4>Input/output options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-A, --keep-alts</strong></span>
</span></dt><dd>
    output all alternate alleles present in the alignments even if they do not
    appear in any of the genotypes
</dd><dt><span class="term">
<span class="strong"><strong>-f, --format-fields</strong></span> <span class="emphasis"><em>list</em></span>
</span></dt><dd>
    comma-separated list of FORMAT fields to output for each sample. Currently
    GQ and GP fields are supported. For convenience, the fields can be given
    as lower case letters.
</dd><dt><span class="term">
<span class="strong"><strong>-F, --prior-freqs</strong></span> <span class="emphasis"><em>AN</em></span>,<span class="emphasis"><em>AC</em></span>
</span></dt><dd>
    take advantage of prior knowledge of population allele frequencies. The
    workflow looks like this:
</dd></dl></div><pre class="screen">    # Extract AN,AC values from an existing VCF, such 1000Genomes
    bcftools query -f'%CHROM\t%POS\t%REF\t%ALT\t%AN\t%AC\n' 1000Genomes.bcf | bgzip -c &gt; AFs.tab.gz

    # If the tags AN,AC are not already present, use the +fill-tags plugin
    bcftools +fill-tags 1000Genomes.bcf | bcftools query -f'%CHROM\t%POS\t%REF\t%ALT\t%AN\t%AC\n' | bgzip -c &gt; AFs.tab.gz
    tabix -s1 -b2 -e2 AFs.tab.gz

    # Create a VCF header description, here we name the tags REF_AN,REF_AC
    cat AFs.hdr
    ##INFO=&lt;ID=REF_AN,Number=1,Type=Integer,Description="Total number of alleles in reference genotypes"&gt;
    ##INFO=&lt;ID=REF_AC,Number=A,Type=Integer,Description="Allele count in reference genotypes for each ALT allele"&gt;

    # Now before calling, stream the raw mpileup output through `bcftools annotate` to add the frequencies
    bcftools mpileup [...] -Ou | bcftools annotate -a AFs.tab.gz -h AFs.hdr -c CHROM,POS,REF,ALT,REF_AN,REF_AC -Ou | bcftools call -mv -F REF_AN,REF_AC [...]</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-G, --group-samples</strong></span> <span class="emphasis"><em>FILE</em></span>|<span class="emphasis"><em>-</em></span>
</span></dt><dd>
    by default, all samples are assumed to come from a single population. This option allows to group samples
    into populations and apply the HWE assumption within but not across the populations. <span class="emphasis"><em>FILE</em></span> is a tab-delimited
    text file with sample names in the first column and group names in the second column. If <span class="emphasis"><em>-</em></span> is
    given instead, no HWE assumption is made at all and single-sample calling is performed. (Note that
    in low coverage data this inflates the rate of false positives.) The <span class="strong"><strong>-G</strong></span> option requires the presence of
    FORMAT/AD generated at the <span class="strong"><strong>bcftools mpileup</strong></span> step by providing the <span class="strong"><strong>-a FMT/AD</strong></span> option.
</dd><dt><span class="term">
<span class="strong"><strong>-g, --gvcf</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    output also gVCF blocks of homozygous REF calls. The parameter <span class="emphasis"><em>INT</em></span> is the
    minimum per-sample depth required to include a site in the non-variant
    block.
</dd><dt><span class="term">
<span class="strong"><strong>-i, --insert-missed</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    output also sites missed by mpileup but present in <span class="strong"><strong>-T, --targets-file</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-M, --keep-masked-ref</strong></span>
</span></dt><dd>
    output sites where REF allele is N
</dd><dt><span class="term">
<span class="strong"><strong>-V, --skip-variants</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>
</span></dt><dd>
    skip indel/SNP sites
</dd><dt><span class="term">
<span class="strong"><strong>-v, --variants-only</strong></span>
</span></dt><dd>
    output variant sites only
</dd></dl></div></div><div class="refsect3" title="Consensus/variant calling options:"><a id="_consensus_variant_calling_options"></a><h4>Consensus/variant calling options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --consensus-caller</strong></span>
</span></dt><dd>
    the original <span class="strong"><strong>samtools</strong></span>/<span class="strong"><strong>bcftools</strong></span> calling method (conflicts with <span class="strong"><strong>-m</strong></span>)
</dd><dt><span class="term">
<span class="strong"><strong>-C, --constrain</strong></span> <span class="emphasis"><em>alleles</em></span>|<span class="emphasis"><em>trio</em></span>
</span></dt><dd><div class="variablelist"><dl><dt><span class="term">
<span class="emphasis"><em>alleles</em></span>
</span></dt><dd>
            call genotypes given alleles. See also <span class="strong"><strong>-T, --targets-file</strong></span>.
</dd><dt><span class="term">
<span class="emphasis"><em>trio</em></span>
</span></dt><dd>
            call genotypes given the father-mother-child constraint. See also
            <span class="strong"><strong>-s, --samples</strong></span> and <span class="strong"><strong>-n, --novel-rate</strong></span>.
</dd></dl></div></dd><dt><span class="term">
<span class="strong"><strong>-m, --multiallelic-caller</strong></span>
</span></dt><dd>
    alternative model for multiallelic and rare-variant calling designed to
    overcome known limitations in <span class="strong"><strong>-c</strong></span> calling model (conflicts with <span class="strong"><strong>-c</strong></span>)
</dd><dt><span class="term">
<span class="strong"><strong>-n, --novel-rate</strong></span> <span class="emphasis"><em>float</em></span>[,…]
</span></dt><dd>
    likelihood of novel mutation for constrained <span class="strong"><strong>-C</strong></span> <span class="emphasis"><em>trio</em></span> calling. The trio
    genotype calling maximizes likelihood of a particular combination of
    genotypes for father, mother and the child
    P(F=i,M=j,C=k) = P(unconstrained) * Pn + P(constrained) * (1-Pn).
    By providing three values, the mutation rate Pn is set explicitly for SNPs,
    deletions and insertions, respectively.  If two values are given, the first
    is interpreted as the mutation rate of SNPs and the second is used to
    calculate the mutation rate of indels according to their length as
    Pn=<span class="emphasis"><em>float</em></span>*exp(-a-b*len), where a=22.8689, b=0.2994 for insertions and
    a=21.9313, b=0.2856 for deletions [pubmed:23975140].  If only one value is
    given, the same mutation rate Pn is used for SNPs and indels.
</dd><dt><span class="term">
<span class="strong"><strong>-p, --pval-threshold</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    with <span class="strong"><strong>-c</strong></span>, accept variant if P(ref|D) &lt; <span class="emphasis"><em>float</em></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-P, --prior</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    expected substitution rate, or 0 to disable the prior. Only with <span class="strong"><strong>-m</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>file</em></span>|<span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-X, --chromosome-X</strong></span>
</span></dt><dd>
    haploid output for male samples (requires PED file with <span class="strong"><strong>-s</strong></span>)
</dd><dt><span class="term">
<span class="strong"><strong>-Y, --chromosome-Y</strong></span>
</span></dt><dd>
    haploid output for males and skips females (requires PED file with <span class="strong"><strong>-s</strong></span>)
</dd></dl></div></div></div><div class="refsect2" title="bcftools cnv [OPTIONS] FILE"><a id="cnv"></a><h3>bcftools cnv <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Copy number variation caller, requires a VCF annotated with the Illumina’s
B-allele frequency (BAF) and Log R Ratio intensity (LRR) values. The HMM
considers the following copy number states: CN 2 (normal), 1 (single-copy
loss), 0 (complete loss), 3 (single-copy gain).</p><div class="refsect3" title="General Options:"><a id="_general_options"></a><h4>General Options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --control-sample</strong></span> <span class="emphasis"><em>string</em></span>
</span></dt><dd>
    optional control sample name. If given, pairwise calling is performed
    and the <span class="strong"><strong>-P</strong></span>  option can be used
</dd><dt><span class="term">
<span class="strong"><strong>-f, --AF-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    read allele frequencies from  a tab-delimited file with the columns CHR,POS,REF,ALT,AF
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output-dir</strong></span> <span class="emphasis"><em>path</em></span>
</span></dt><dd>
    output directory
</dd><dt><span class="term">
<span class="strong"><strong>-p, --plot-threshold</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    call <span class="strong"><strong>matplotlib</strong></span> to produce plots for chromosomes with quality at least <span class="emphasis"><em>float</em></span>,
    useful for visual inspection of the calls. With <span class="strong"><strong>-p 0</strong></span>, plots for all chromosomes will be
    generated. If not given, a <span class="strong"><strong>matplotlib</strong></span> script will be created but not called.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --query-sample</strong></span> <span class="emphasis"><em>string</em></span>
</span></dt><dd>
    query sample name
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="HMM Options:"><a id="_hmm_options"></a><h4>HMM Options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-a, --aberrant</strong></span> <span class="emphasis"><em>float</em></span>[,<span class="emphasis"><em>float</em></span>]
</span></dt><dd>
    fraction of aberrant cells in query and control. The hallmark of
    duplications and contaminations is the BAF value of heterozygous markers
    which is dependent on the fraction of aberrant cells. Sensitivity to
    smaller fractions of cells can be increased by setting <span class="strong"><strong>-a</strong></span> to a lower value. Note
    however, that this comes at the cost of increased false discovery rate.
</dd><dt><span class="term">
<span class="strong"><strong>-b, --BAF-weight</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    relative contribution from BAF
</dd><dt><span class="term">
<span class="strong"><strong>-d, --BAF-dev</strong></span> <span class="emphasis"><em>float</em></span>[,<span class="emphasis"><em>float</em></span>]
</span></dt><dd>
    expected BAF deviation in query and control, i.e. the noise observed
    in the data.
</dd><dt><span class="term">
<span class="strong"><strong>-e, --err-prob</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    uniform error probability
</dd><dt><span class="term">
<span class="strong"><strong>-l, --LRR-weight</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    relative contribution from LRR. With noisy data, this option can have big effect
    on the number of calls produced. In truly random noise (such as in simulated data),
    the value should be set high (1.0), but in the presence of systematic noise
    when LRR are not informative, lower values result in cleaner calls (0.2).
</dd><dt><span class="term">
<span class="strong"><strong>-L, --LRR-smooth-win</strong></span> <span class="emphasis"><em>int</em></span>
</span></dt><dd>
    reduce LRR noise by applying moving average given this window size
</dd><dt><span class="term">
<span class="strong"><strong>-O, --optimize</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    iteratively estimate the fraction of aberrant cells, down to the given fraction.
    Lowering this value from the default 1.0 to say, 0.3, can help discover more
    events but also increases noise
</dd><dt><span class="term">
<span class="strong"><strong>-P, --same-prob</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    the prior probability of the query and the control sample being the same.
    Setting to 0 calls both independently, setting to 1 forces the same copy
    number state in both.
</dd><dt><span class="term">
<span class="strong"><strong>-x, --xy-prob</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    the HMM probability of transition to another copy number state. Increasing this
    values leads to smaller and more frequent calls.
</dd></dl></div></div></div><div class="refsect2" title="bcftools concat [OPTIONS] FILE1 FILE2 […]"><a id="concat"></a><h3>bcftools concat <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE1</em></span> <span class="emphasis"><em>FILE2</em></span> […]</h3><p>Concatenate or combine VCF/BCF files. All source files must have the same sample
columns appearing in the same order. Can be used, for example, to
concatenate chromosome VCFs into one VCF, or combine a SNP VCF and an indel
VCF into one. The input files must be sorted by chr and position. The files
must be given in the correct order to produce sorted VCF on output unless
the <span class="strong"><strong>-a, --allow-overlaps</strong></span> option is specified. With the --naive option, the files
are concatenated without being recompressed, which is very fast..</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-a, --allow-overlaps</strong></span>
</span></dt><dd>
    First coordinate of the next file can precede last record of the current file.
</dd><dt><span class="term">
<span class="strong"><strong>-c, --compact-PS</strong></span>
</span></dt><dd>
    Do not output PS tag at each site, only at the start of a new phase set block.
</dd><dt><span class="term">
<span class="strong"><strong>-d, --rm-dups</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>none</em></span>
</span></dt><dd>
    Output duplicate records of specified type present in multiple files only once.
    Requires <span class="strong"><strong>-a, --allow-overlaps</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-D, --remove-duplicates</strong></span>
</span></dt><dd>
    Alias for <span class="strong"><strong>-d none</strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-f, --file-list</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Read file names from <span class="emphasis"><em>FILE</em></span>, one file name per line.
</dd><dt><span class="term">
<span class="strong"><strong>-l, --ligate</strong></span>
</span></dt><dd>
    Ligate phased VCFs by matching phase at overlapping haplotypes.
    Note that the option is intended for VCFs with perfect overlap, sites
    in overlapping regions present in one but missing in other are dropped.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-n, --naive</strong></span>
</span></dt><dd>
    Concatenate VCF or BCF files without recompression. This is very fast but requires
    that all files are of the same type (all VCF or all BCF) and have the same headers.
    This is because all tags and chromosome names in the BCF body rely on the order
    of the contig and tag definitions in the header. A header check compatibility
    is performed and the program throws an error if it is not safe to use the option.
</dd><dt><span class="term">
<span class="strong"><strong>--naive-force</strong></span>
</span></dt><dd>
    Same as --naive, but header compatibility is not checked. Dangerous, use with caution.
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-q, --min-PQ</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Break phase set if phasing quality is lower than <span class="emphasis"><em>INT</em></span>
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. Requires <span class="strong"><strong>-a, --allow-overlaps</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. Requires <span class="strong"><strong>-a, --allow-overlaps</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect2" title="bcftools consensus [OPTIONS] FILE"><a id="consensus"></a><h3>bcftools consensus <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Create consensus sequence by applying VCF variants to a reference fasta file.
By default, the program will apply all ALT variants to the reference fasta to
obtain the consensus sequence. Using the <span class="strong"><strong>--sample</strong></span> (and, optionally,
<span class="strong"><strong>--haplotype</strong></span>) option will apply genotype (haplotype) calls from FORMAT/GT.
Note that the program does not act as a primitive variant caller and ignores allelic
depth information, such as INFO/AD or FORMAT/AD. For that, consider using the
<span class="strong"><strong>setGT</strong></span> plugin.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --chain</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    write a chain file for liftover
</dd><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    reference sequence in fasta format
</dd><dt><span class="term">
<span class="strong"><strong>-H, --haplotype</strong></span> <span class="emphasis"><em>1</em></span>|<span class="emphasis"><em>2</em></span>|<span class="emphasis"><em>R</em></span>|<span class="emphasis"><em>A</em></span>|<span class="emphasis"><em>LR</em></span>|<span class="emphasis"><em>LA</em></span>|<span class="emphasis"><em>SR</em></span>|<span class="emphasis"><em>SA</em></span>|<span class="emphasis"><em>1pIu</em></span>|<span class="emphasis"><em>2pIu</em></span>
</span></dt><dd><p class="simpara">
    choose which allele from the FORMAT/GT field to use (the codes are case-insensitive):
</p><div class="variablelist"><dl><dt><span class="term">
<span class="emphasis"><em>1</em></span>
</span></dt><dd>
            the first allele, regardless of phasing
</dd><dt><span class="term">
<span class="emphasis"><em>2</em></span>
</span></dt><dd>
            the second allele, regardless of phasing
</dd><dt><span class="term">
<span class="emphasis"><em>R</em></span>
</span></dt><dd>
            the REF allele (in heterozygous genotypes)
</dd><dt><span class="term">
<span class="emphasis"><em>A</em></span>
</span></dt><dd>
            the ALT allele (in heterozygous genotypes)
</dd><dt><span class="term">
<span class="emphasis"><em>LR, LA</em></span>
</span></dt><dd>
            the longer allele. If both have the same length, use the REF allele (LR), or the ALT allele  (LA)
</dd><dt><span class="term">
<span class="emphasis"><em>SR, SA</em></span>
</span></dt><dd>
            the shorter allele. If both have the same length, use the REF allele (SR), or the ALT allele  (SA)
</dd><dt><span class="term">
<span class="emphasis"><em>1pIu, 2pIu</em></span>
</span></dt><dd><p class="simpara">
            first/second allele for phased genotypes and IUPAC code for unphased genotypes
</p><pre class="literallayout">This option requires *-s*, unless exactly one sample is present in the VCF</pre></dd></dl></div></dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-I, --iupac-codes</strong></span>
</span></dt><dd>
    output variants in the form of IUPAC ambiguity codes
</dd><dt><span class="term">
<span class="strong"><strong>-m, --mask</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    BED file or TAB file with regions to be replaced with N. See discussion
    of <span class="strong"><strong>--regions-file</strong></span> in <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span> for file
    format details.
</dd><dt><span class="term">
<span class="strong"><strong>-M, --missing</strong></span> <span class="emphasis"><em>CHAR</em></span>
</span></dt><dd>
    instead of skipping the missing genotypes, output the character CHAR (e.g. "?")
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    write output to a file
</dd><dt><span class="term">
<span class="strong"><strong>-s, --sample</strong></span> <span class="emphasis"><em>NAME</em></span>
</span></dt><dd>
    apply variants of the given sample
</dd></dl></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="screen">    # Apply variants present in sample "NA001", output IUPAC codes for hets
    bcftools consensus -i -s NA001 -f in.fa in.vcf.gz &gt; out.fa

    # Create consensus for one region. The fasta header lines are then expected
    # in the form "&gt;chr:from-to".
    samtools faidx ref.fa 8:11870-11890 | bcftools consensus in.vcf.gz -o out.fa</pre></div><div class="refsect2" title="bcftools convert [OPTIONS] FILE"><a id="convert"></a><h3>bcftools convert <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><div class="refsect3" title="VCF input options:"><a id="_vcf_input_options"></a><h4>VCF input options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="VCF output options:"><a id="_vcf_output_options"></a><h4>VCF output options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="GEN/SAMPLE conversion:"><a id="_gen_sample_conversion"></a><h4>GEN/SAMPLE conversion:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-G, --gensample2vcf</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>gen-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
</span></dt><dd>
    convert IMPUTE2 output to VCF. The second column must be of the form
    "CHROM:POS_REF_ALT" to detect possible strand swaps; IMPUTE2 leaves the
    first one empty ("--") when sites from reference panel are filled in. See
    also <span class="strong"><strong>-g</strong></span> below.
</dd><dt><span class="term">
<span class="strong"><strong>-g, --gensample</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>gen-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
</span></dt><dd>
    convert from VCF to gen/sample format used by IMPUTE2 and SHAPEIT.
    The columns of .gen file format are ID1,ID2,POS,A,B followed by three
    genotype probabilities P(AA), P(AB), P(BB) for each sample.  In order to
    prevent strand swaps, the program uses IDs of the form "CHROM:POS_REF_ALT".
    For example:
</dd></dl></div><pre class="screen">  .gen
  ----
  1:111485207_G_A 1:111485207_G_A 111485207 G A 0 1 0 0 1 0
  1:111494194_C_T 1:111494194_C_T 111494194 C T 0 1 0 0 0 1

  .sample
  -------
  ID_1 ID_2 missing
  0 0 0
  sample1 sample1 0
  sample2 sample2 0</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--tag</strong></span> <span class="emphasis"><em>STRING</em></span>
</span></dt><dd>
    tag to take values for .gen file: GT,PL,GL,GP
</dd><dt><span class="term">
<span class="strong"><strong>--chrom</strong></span>
</span></dt><dd>
    output chromosome in the first column instead of CHROM:POS_REF_ALT
</dd><dt><span class="term">
<span class="strong"><strong>--sex</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    output sex column in the sample file. The FILE format is
</dd></dl></div><pre class="screen">    MaleSample    M
    FemaleSample  F</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--vcf-ids</strong></span>
</span></dt><dd>
    output VCF IDs in the second column instead of CHROM:POS_REF_ALT
</dd></dl></div></div><div class="refsect3" title="gVCF conversion:"><a id="_gvcf_conversion"></a><h4>gVCF conversion:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--gvcf2vcf</strong></span>
</span></dt><dd>
    convert gVCF to VCF, expanding REF blocks into sites. Note that
    the <span class="strong"><strong>-i</strong></span> and <span class="strong"><strong>-e</strong></span> options work differently with this switch. In this situation
    the filtering expressions define which sites should be expanded and
    which sites should be left unmodified, but all sites are printed on
    output. In order to drop sites, stream first through <span class="strong"><strong><a class="link" href="#view" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]">bcftools view</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    reference sequence in fasta format. Must be indexed with samtools faidx
</dd></dl></div></div><div class="refsect3" title="HAP/SAMPLE conversion:"><a id="_hap_sample_conversion"></a><h4>HAP/SAMPLE conversion:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--hapsample2vcf</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>hap-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
</span></dt><dd>
    convert from hap/sample format to VCF. The columns of .hap file are
    similar to .gen file above, but there are only two haplotype columns per
    sample. Note that the first column of the .hap file is expected to be in
    the form "CHR:POS_REF_ALT(_END)?", with the _END being optional for
    defining the INFO/END tag when ALT is a symbolic allele, for example:
</dd></dl></div><pre class="screen">  .hap
  ----
  1:111485207_G_A rsID1 111485207 G A 0 1 0 0
  1:111494194_C_T rsID2 111494194 C T 0 1 0 0
  1:111495231_A_&lt;DEL&gt;_111495784 rsID3 111495231 A &lt;DEL&gt; 0 0 1 0</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--hapsample</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>hap-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
</span></dt><dd>
    convert from VCF to hap/sample format used by IMPUTE2 and SHAPEIT.
    The columns of .hap file begin with ID,RSID,POS,REF,ALT. In order to
    prevent strand swaps, the program uses IDs of the form
    "CHROM:POS_REF_ALT".
</dd><dt><span class="term">
<span class="strong"><strong>--haploid2diploid</strong></span>
</span></dt><dd>
    with <span class="strong"><strong>-h</strong></span> option converts haploid genotypes to homozygous diploid
    genotypes. For example, the program will print <span class="emphasis"><em>0 0</em></span> instead of the
    default <span class="emphasis"><em>0 -</em></span>. This is useful for programs which do not handle haploid
    genotypes correctly.
</dd><dt><span class="term">
<span class="strong"><strong>--sex</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    output sex column in the sample file. The FILE format is
</dd></dl></div><pre class="screen">    MaleSample    M
    FemaleSample  F</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--vcf-ids</strong></span>
</span></dt><dd>
    output VCF IDs instead of "CHROM:POS_REF_ALT" IDs
</dd></dl></div></div><div class="refsect3" title="HAP/LEGEND/SAMPLE conversion:"><a id="_hap_legend_sample_conversion"></a><h4>HAP/LEGEND/SAMPLE conversion:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-H, --haplegendsample2vcf</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>hap-file</em></span>,<span class="emphasis"><em>legend-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
</span></dt><dd>
    convert from hap/legend/sample format used by IMPUTE2 to VCF, see
    also <span class="strong"><strong>-h, --hapslegendsample</strong></span> below.
</dd><dt><span class="term">
<span class="strong"><strong>-h, --haplegendsample</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>hap-file</em></span>,<span class="emphasis"><em>legend-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
</span></dt><dd>
    convert from VCF to hap/legend/sample format used by IMPUTE2 and SHAPEIT.
    The columns of .legend file ID,POS,REF,ALT. In order to prevent strand
    swaps, the program uses IDs of the form "CHROM:POS_REF_ALT". The .sample
    file is quite basic at the moment with columns for population, group and
    sex expected to be edited by the user. For example:
</dd></dl></div><pre class="screen">  .hap
  -----
  0 1 0 0 1 0
  0 1 0 0 0 1

  .legend
  -------
  id position a0 a1
  1:111485207_G_A 111485207 G A
  1:111494194_C_T 111494194 C T

  .sample
  -------
  sample population group sex
  sample1 sample1 sample1 2
  sample2 sample2 sample2 2</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--haploid2diploid</strong></span>
</span></dt><dd>
    with <span class="strong"><strong>-h</strong></span> option converts haploid genotypes to homozygous diploid
    genotypes. For example, the program will print <span class="emphasis"><em>0 0</em></span> instead of the
    default <span class="emphasis"><em>0 -</em></span>. This is useful for programs which do not handle haploid
    genotypes correctly.
</dd><dt><span class="term">
<span class="strong"><strong>--sex</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    output sex column in the sample file. The FILE format is
</dd></dl></div><pre class="screen">    MaleSample    M
    FemaleSample  F</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--vcf-ids</strong></span>
</span></dt><dd>
    output VCF IDs instead of "CHROM:POS_REF_ALT" IDs
</dd></dl></div></div><div class="refsect3" title="TSV conversion:"><a id="_tsv_conversion"></a><h4>TSV conversion:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--tsv2vcf</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    convert from TSV (tab-separated values) format (such as generated by
    23andMe) to VCF. The input file fields can be tab- or space- delimited
</dd><dt><span class="term">
<span class="strong"><strong>-c, --columns</strong></span> <span class="emphasis"><em>list</em></span>
</span></dt><dd>
    comma-separated list of fields in the input file. In the current
    version, the fields CHROM, POS, ID, and AA are expected and
    can appear in arbitrary order, columns which should be ignored in the input
    file can be indicated by "-".
    The AA field lists alleles on the forward reference strand,
    for example "CC" or "CT" for diploid genotypes or "C"
    for haploid genotypes (sex chromosomes). Insertions and deletions
    are not supported yet, missing data can be indicated with "--".
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    reference sequence in fasta format. Must be indexed with samtools faidx
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    list of sample names. See <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    file of sample names. See <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div><p><span class="strong"><strong>Example:</strong></span></p><pre class="screen"># Convert 23andme results into VCF
bcftools convert -c ID,CHROM,POS,AA -s SampleName -f 23andme-ref.fa --tsv2vcf 23andme.txt -Oz -o out.vcf.gz</pre></div></div><div class="refsect2" title="bcftools csq [OPTIONS] FILE"><a id="csq"></a><h3>bcftools csq <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Haplotype aware consequence predictor which correctly handles combined
variants such as MNPs split over multiple VCF records, SNPs separated by
an intron (but adjacent in the spliced transcript) or nearby frame-shifting
indels which in combination in fact are not frame-shifting.</p><p>The output VCF is annotated with INFO/BCSQ and FORMAT/BCSQ tag (configurable
with the <span class="strong"><strong>-c</strong></span> option). The latter is a bitmask of indexes to INFO/BCSQ, with
interleaved haplotypes. See the usage examples below for using the %TBCSQ
converter in <span class="strong"><strong>query</strong></span> for extracting a more human readable form from this
bitmask. The construction of the bitmask limits the number of consequences
that can be referenced in the FORMAT/BCSQ tags. By default this is 16, but
if more are required, see the <span class="strong"><strong>--ncsq</strong></span> option.</p><p>The program requires on input a VCF/BCF file, the reference genome in fasta
format (<span class="strong"><strong>--fasta-ref</strong></span>) and genomic features in the GFF3 format downloadable
from the Ensembl website (<span class="strong"><strong>--gff-annot</strong></span>), and outputs an annotated VCF/BCF
file. Currently, only Ensembl GFF3 files are supported.</p><p>By default, the input VCF should be phased. If phase is unknown, or only
partially known, the <span class="strong"><strong>--phase</strong></span> option can be used to indicate how to handle
unphased data. Alternatively, haplotype aware calling can be turned off
with the <span class="strong"><strong>--local-csq</strong></span> option.</p><p>If conflicting (overlapping) variants within one haplotype are detected,
a warning will be emitted and predictions will be based on only the first
variant in the analysis.</p><p>Symbolic alleles are not supported. They will remain unannotated in the
output VCF and are ignored for the prediction analysis.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --custom-tag</strong></span> <span class="emphasis"><em>STRING</em></span>
</span></dt><dd>
    use this custom tag to store consequences rather than the default BCSQ tag
</dd><dt><span class="term">
<span class="strong"><strong>-b, --brief-predictions</strong></span>
</span></dt><dd>
    annotate with abbreviated protein-changing predictions. That is, instead of writing
    the whole modified protein sequence with potentially hundreds of aminoacids, only an
    abbreviated version such as <span class="emphasis"><em>25E..329&gt;25G..94</em></span> will be written
</dd><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    reference sequence in fasta format (required)
</dd><dt><span class="term">
<span class="strong"><strong>--force</strong></span>
</span></dt><dd>
    run even if some sanity checks fail. Currently the option allows to skip
    transcripts in malformatted GFFs with incorrect phase
</dd><dt><span class="term">
<span class="strong"><strong>-g, --gff-annot</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    GFF3 annotation file (required), such as <a class="ulink" href="ftp://ftp.ensembl.org/pub/current_gff3/homo_sapiens" target="_top">ftp://ftp.ensembl.org/pub/current_gff3/homo_sapiens</a>.
    An example of a minimal working GFF file:
</dd></dl></div><pre class="screen">    # The program looks for "CDS", "exon", "three_prime_UTR" and "five_prime_UTR" lines,
    # looks up their parent transcript (determined from the "Parent=transcript:" attribute),
    # the gene (determined from the transcript's "Parent=gene:" attribute), and the biotype
    # (the most interesting is "protein_coding").
    #
    # Attributes required for
    #   gene lines:
    #   - ID=gene:&lt;gene_id&gt;
    #   - biotype=&lt;biotype&gt;
    #   - Name=&lt;gene_name&gt;      [optional]
    #
    #   transcript lines:
    #   - ID=transcript:&lt;transcript_id&gt;
    #   - Parent=gene:&lt;gene_id&gt;
    #   - biotype=&lt;biotype&gt;
    #
    #   other lines (CDS, exon, five_prime_UTR, three_prime_UTR):
    #   - Parent=transcript:&lt;transcript_id&gt;
    #
    # Supported biotypes:
    #   - see the function gff_parse_biotype() in bcftools/csq.c

    1   ignored_field  gene            21  2148  .   -   .   ID=gene:GeneId;biotype=protein_coding;Name=GeneName
    1   ignored_field  transcript      21  2148  .   -   .   ID=transcript:TranscriptId;Parent=gene:GeneId;biotype=protein_coding
    1   ignored_field  three_prime_UTR 21  2054  .   -   .   Parent=transcript:TranscriptId
    1   ignored_field  exon            21  2148  .   -   .   Parent=transcript:TranscriptId
    1   ignored_field  CDS             21  2148  .   -   1   Parent=transcript:TranscriptId
    1   ignored_field  five_prime_UTR  210 2148  .   -   .   Parent=transcript:TranscriptId</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-l, --local-csq</strong></span>
</span></dt><dd>
    switch off haplotype-aware calling, run localized predictions considering
    only one VCF record at a time
</dd><dt><span class="term">
<span class="strong"><strong>-n, --ncsq</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    maximum number of consequences to consider per site. The INFO/BCSQ column includes
    all consequences, but only the first <span class="emphasis"><em>INT</em></span> will be referenced by the FORMAT/BCSQ fields.
    The default value is 16 which corresponds to one integer per diploid
    sample. Note that increasing the value leads to increased memory and is rarely necessary.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>t</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. In addition, a custom tab-delimited
    plain text output can be printed (<span class="emphasis"><em>t</em></span>).
</dd><dt><span class="term">
<span class="strong"><strong>-p, --phase</strong></span> <span class="emphasis"><em>a</em></span>|<span class="emphasis"><em>m</em></span>|<span class="emphasis"><em>r</em></span>|<span class="emphasis"><em>R</em></span>|<span class="emphasis"><em>s</em></span>
</span></dt><dd><p class="simpara">
    how to handle unphased heterozygous genotypes:
</p><div class="variablelist"><dl><dt><span class="term">
<span class="emphasis"><em>a</em></span>
</span></dt><dd>
            take GTs as is, create haplotypes regardless of phase (0/1 → 0|1)
</dd><dt><span class="term">
<span class="emphasis"><em>m</em></span>
</span></dt><dd>
            merge all GTs into a single haplotype (0/1 → 1, 1/2 → 1)
</dd><dt><span class="term">
<span class="emphasis"><em>r</em></span>
</span></dt><dd>
            require phased GTs, throw an error on unphased heterozygous GTs
</dd><dt><span class="term">
<span class="emphasis"><em>R</em></span>
</span></dt><dd>
            create non-reference haplotypes if possible (0/1 → 1|1, 1/2 → 1|2)
</dd><dt><span class="term">
<span class="emphasis"><em>s</em></span>
</span></dt><dd>
            skip unphased heterozygous GTs
</dd></dl></div></dd><dt><span class="term">
<span class="strong"><strong>-q, --quiet</strong></span>
</span></dt><dd>
    suppress warning messages
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    samples to include or "-" to apply all variants and ignore samples
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="screen">    # Basic usage
    bcftools csq -f hs37d5.fa -g Homo_sapiens.GRCh37.82.gff3.gz in.vcf -Ob -o out.bcf

    # Extract the translated haplotype consequences. The following TBCSQ variations
    # are recognised:
    #   %TBCSQ    .. print consequences in all haplotypes in separate columns
    #   %TBCSQ{0} .. print the first haplotype only
    #   %TBCSQ{1} .. print the second haplotype only
    #   %TBCSQ{*} .. print a list of unique consequences present in either haplotype
    bcftools query -f'[%CHROM\t%POS\t%SAMPLE\t%TBCSQ\n]' out.bcf</pre><p><span class="strong"><strong>Examples of BCSQ annotation:</strong></span></p><pre class="screen">    # Two separate VCF records at positions 2:122106101 and 2:122106102
    # change the same codon. This UV-induced C&gt;T dinucleotide mutation
    # has been annotated fully at the position 2:122106101 with
    #   - consequence type
    #   - gene name
    #   - ensembl transcript ID
    #   - coding strand (+ fwd, - rev)
    #   - amino acid position (in the coding strand orientation)
    #   - list of corresponding VCF variants
    # The annotation at the second position gives the position of the full
    # annotation
    BCSQ=missense|CLASP1|ENST00000545861|-|1174P&gt;1174L|122106101G&gt;A+122106102G&gt;A
    BCSQ=@122106101

    # A frame-restoring combination of two frameshift insertions C&gt;CG and T&gt;TGG
    BCSQ=@46115084
    BCSQ=inframe_insertion|COPZ2|ENST00000006101|-|18AGRGP&gt;18AQAGGP|46115072C&gt;CG+46115084T&gt;TGG

    # Stop gained variant
    BCSQ=stop_gained|C2orf83|ENST00000264387|-|141W&gt;141*|228476140C&gt;T

    # The consequence type of a variant downstream from a stop are prefixed with *
    BCSQ=*missense|PER3|ENST00000361923|+|1028M&gt;1028T|7890117T&gt;C</pre></div><div class="refsect2" title="bcftools filter [OPTIONS] FILE"><a id="filter"></a><h3>bcftools filter <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Apply fixed-threshold filters.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-g, --SnpGap</strong></span> <span class="emphasis"><em>INT</em></span>[:'indel',<span class="emphasis"><em>mnp</em></span>,<span class="emphasis"><em>bnd</em></span>,<span class="emphasis"><em>other</em></span>,<span class="emphasis"><em>overlap</em></span>]
</span></dt><dd>
    filter SNPs within <span class="emphasis"><em>INT</em></span> base pairs of an indel or other other variant type. The following example
    demonstrates the logic of <span class="strong"><strong>--SnpGap</strong></span> <span class="emphasis"><em>3</em></span> applied on a deletion and
    an insertion:
</dd></dl></div><pre class="screen">The SNPs at positions 1 and 7 are filtered, positions 0 and 8 are not:
         0123456789
    ref  .G.GT..G..
    del  .A.G-..A..
Here the positions 1 and 6 are filtered, 0 and 7 are not:
         0123-456789
    ref  .G.G-..G..
    ins  .A.GT..A..</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-G, --IndelGap</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    filter clusters of indels separated by <span class="emphasis"><em>INT</em></span> or fewer base pairs allowing
    only one to pass. The following example demonstrates the logic of
    <span class="strong"><strong>--IndelGap</strong></span> <span class="emphasis"><em>2</em></span> applied on a deletion and an insertion:
</dd></dl></div><pre class="screen">The second indel is filtered:
         012345678901
    ref  .GT.GT..GT..
    del  .G-.G-..G-..
And similarly here, the second is filtered:
         01 23 456 78
    ref  .A-.A-..A-..
    ins  .AT.AT..AT..</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-m, --mode</strong></span> [<span class="emphasis"><em>+x</em></span>]
</span></dt><dd>
    define behaviour at sites with existing FILTER annotations. The default
    mode replaces existing filters of failed sites with a new FILTER string
    while leaving sites which pass untouched when non-empty and setting to
    "PASS" when the FILTER string is absent. The "+" mode appends new FILTER
    strings of failed sites instead of replacing them. The "x" mode resets
    filters of sites which pass to "PASS". Modes "+" and "x" can both be set.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --soft-filter</strong></span> <span class="emphasis"><em>STRING</em></span>|<span class="emphasis"><em>+</em></span>
</span></dt><dd>
    annotate FILTER column with <span class="emphasis"><em>STRING</em></span> or, with <span class="emphasis"><em>+</em></span>, a unique filter name generated
    by the program ("Filter%d").
</dd><dt><span class="term">
<span class="strong"><strong>-S, --set-GTs</strong></span> <span class="emphasis"><em>.</em></span>|<span class="emphasis"><em>0</em></span>
</span></dt><dd>
    set genotypes of failed samples to missing value (<span class="emphasis"><em>.</em></span>) or reference allele (<span class="emphasis"><em>0</em></span>)
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect2" title="bcftools gtcheck [OPTIONS] [-g genotypes.vcf.gz] query.vcf.gz"><a id="gtcheck"></a><h3>bcftools gtcheck [<span class="emphasis"><em>OPTIONS</em></span>] [<span class="strong"><strong>-g</strong></span> <span class="emphasis"><em>genotypes.vcf.gz</em></span>] <span class="emphasis"><em>query.vcf.gz</em></span></h3><p>Checks sample identity. The program can operate in two modes. If the <span class="strong"><strong>-g</strong></span>
option is given, the identity of samples from <span class="emphasis"><em>query.vcf.gz</em></span>
is checked against the samples in the <span class="strong"><strong>-g</strong></span> file.
Without the <span class="strong"><strong>-g</strong></span> option, multi-sample cross-check of samples in <span class="emphasis"><em>query.vcf.gz</em></span> is performed.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--distinctive-sites</strong></span> <span class="emphasis"><em>NUM[,MEM[,DIR]]</em></span>
</span></dt><dd>
    Find sites that can distinguish between at least NUM sample pairs. If the number is smaller or equal to 1,
    it is interpreted as the fraction of pairs.  The optional MEM string sets the maximum memory used for
    in-memory sorting and DIR is the temporary directory for external sorting. This option requires also
    <span class="strong"><strong>--pairs</strong></span> to be given.
</dd><dt><span class="term">
<span class="strong"><strong>--dry-run</strong></span>
</span></dt><dd>
    Stop after first record to estimate required time.
</dd><dt><span class="term">
<span class="strong"><strong>-e, --error-probability</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Interpret genotypes and genotype likelihoods probabilistically. The value of <span class="emphasis"><em>INT</em></span>
    represents genotype quality when GT tag is used (e.g. Q=30 represents one error in 1,000 genotypes and
    Q=40 one error in 10,000 genotypes) and is ignored when PL tag is used (in that case an arbitrary
    non-zero integer can be provided). See also the <span class="strong"><strong>-u, --use</strong></span> option below. If set to 0,
    the discordance equals to the number of mismatching genotypes when GT vs GT is compared.
    If performance is an issue, set to 0 for faster run but less accurate results.
</dd><dt><span class="term">
<span class="strong"><strong>-g, --genotypes</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    VCF/BCF file with reference genotypes to compare against
</dd><dt><span class="term">
<span class="strong"><strong>-H, --homs-only</strong></span>
</span></dt><dd>
    Homozygous genotypes only, useful with low coverage data (requires <span class="strong"><strong>-g, --genotypes</strong></span>)
</dd><dt><span class="term">
<span class="strong"><strong>--n-matches</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Print only top INT matches for each sample, 0 for unlimited. Use negative value
    to sort by HWE probability rather than the number of discordant sites.
</dd><dt><span class="term">
<span class="strong"><strong>--no-HWE-prob</strong></span>
</span></dt><dd>
    Disable calculation of HWE probability to reduce memory requirements with
    comparisons between very large number of sample pairs.
</dd><dt><span class="term">
<span class="strong"><strong>-p, --pairs</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    A comma-separated list of sample pairs to compare. When the <span class="strong"><strong>-g</strong></span> option is given, the first
    sample must be from the query file, the second from the <span class="strong"><strong>-g</strong></span> file, third from the query file
    etc (qry,gt[,qry,gt..]). Without the <span class="strong"><strong>-g</strong></span> option, the pairs are created the same way but both
    samples are from the query file (qry,qry[,qry,qry..])
</dd><dt><span class="term">
<span class="strong"><strong>-P, --pairs-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    A file with tab-delimited sample pairs to compare. The first sample in the pair must come
    from the query file, the second from the genotypes file when <span class="strong"><strong>-g</strong></span> is given
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    Restrict to comma-separated list of regions, see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
*-R, --regions-file' <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Restrict to regions listed in a file, see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div><p><span class="strong"><strong>-s, --samples</strong></span> [<span class="emphasis"><em>qry</em></span>|<span class="emphasis"><em>gt</em></span>]:'LIST':
    List of query samples or <span class="strong"><strong>-g</strong></span> samples. If neither <span class="strong"><strong>-s</strong></span> nor <span class="strong"><strong>-S</strong></span> are given, all possible sample
    pair combinations are compared</p><p><span class="strong"><strong>-S, --samples-file</strong></span> [<span class="emphasis"><em>qry</em></span>|<span class="emphasis"><em>gt</em></span>]:'FILE'
    File with the query or <span class="strong"><strong>-g</strong></span> samples to compare.  If neither <span class="strong"><strong>-s</strong></span> nor <span class="strong"><strong>-S</strong></span> are given, all possible sample
    pair combinations are compared</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-u, --use</strong></span> <span class="emphasis"><em>TAG1</em></span>[,<span class="emphasis"><em>TAG2</em></span>]
</span></dt><dd>
    specifies which tag to use in the query file (<span class="emphasis"><em>TAG1</em></span>) and the <span class="strong"><strong>-g</strong></span> (<span class="emphasis"><em>TAG2</em></span>) file.
    By default, the PL tag is used in the query file and GT in the <span class="strong"><strong>-g</strong></span> file when
    available.
</dd></dl></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="screen">   # Check discordance of all samples from B against all sample in A
   bcftools gtcheck -g A.bcf B.bcf

   # Limit comparisons to the fiven list of samples
   bcftools gtcheck -s gt:a1,a2,a3 -s qry:b1,b2 -g A.bcf B.bcf

   # Compare only two pairs a1,b1 and a1,b2
   bcftools gtcheck -p a1,b1,a1,b2 -g A.bcf B.bcf</pre></div><div class="refsect2" title="bcftools index [OPTIONS] in.bcf|in.vcf.gz"><a id="index"></a><h3>bcftools index [<span class="emphasis"><em>OPTIONS</em></span>]  <span class="emphasis"><em>in.bcf</em></span>|<span class="emphasis"><em>in.vcf.gz</em></span></h3><p>Creates index for bgzip compressed VCF/BCF files for random access. CSI
(coordinate-sorted index) is created by default. The CSI format
supports indexing of chromosomes up to length 2^31. TBI (tabix index)
index files, which support chromosome lengths up to 2^29, can be
created by using the <span class="emphasis"><em>-t/--tbi</em></span> option or using the <span class="emphasis"><em>tabix</em></span> program
packaged with htslib. When loading an index file, bcftools will try
the CSI first and then the TBI.</p><div class="refsect3" title="Indexing options:"><a id="_indexing_options"></a><h4>Indexing options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --csi</strong></span>
</span></dt><dd>
    generate CSI-format index for VCF/BCF files [default]
</dd><dt><span class="term">
<span class="strong"><strong>-f, --force</strong></span>
</span></dt><dd>
    overwrite index if it already exists
</dd><dt><span class="term">
<span class="strong"><strong>-m, --min-shift <span class="emphasis"><em>INT</em></span></strong></span>
</span></dt><dd>
    set minimal interval size for CSI indices to 2^INT; default: 14
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output <span class="emphasis"><em>FILE</em></span></strong></span>
</span></dt><dd>
    output file name. If not set, then the index will be created
    using the input file name plus a <span class="emphasis"><em>.csi</em></span> or <span class="emphasis"><em>.tbi</em></span> extension
</dd><dt><span class="term">
<span class="strong"><strong>-t, --tbi</strong></span>
</span></dt><dd>
    generate TBI-format index for VCF files
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="Stats options:"><a id="_stats_options"></a><h4>Stats options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-n, --nrecords</strong></span>
</span></dt><dd>
    print the number of records based on the CSI or TBI index files
</dd><dt><span class="term">
<span class="strong"><strong>-s, --stats</strong></span>
</span></dt><dd>
    Print per contig stats based on the CSI or TBI index files.
    Output format is three tab-delimited columns listing the contig
    name, contig length (<span class="emphasis"><em>.</em></span> if unknown) and number of records for
    the contig. Contigs with zero records are not printed.
</dd></dl></div></div></div><div class="refsect2" title="bcftools isec [OPTIONS] A.vcf.gz B.vcf.gz […]"><a id="isec"></a><h3>bcftools isec [<span class="emphasis"><em>OPTIONS</em></span>]  <span class="emphasis"><em>A.vcf.gz</em></span> <span class="emphasis"><em>B.vcf.gz</em></span> […]</h3><p>Creates intersections, unions and complements of VCF files. Depending
on the options, the program can output records from one (or more) files
which have (or do not have) corresponding records with the same position
in the other files.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-C, --complement</strong></span>
</span></dt><dd>
    output positions present only in the first file but missing in the others
</dd><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>-</em></span>|<span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. If <span class="strong"><strong>-e</strong></span> (or <span class="strong"><strong>-i</strong></span>)
    appears only once, the same filtering expression will be applied to all
    input files.  Otherwise, <span class="strong"><strong>-e</strong></span> or <span class="strong"><strong>-i</strong></span> must be given for each input file.
    To indicate that no filtering should be performed on a file, use "-" in
    place of <span class="emphasis"><em>EXPRESSION</em></span>, as shown in the example below.
    For valid expressions see <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. See discussion
    of <span class="strong"><strong>-e, --exclude</strong></span> above.
</dd><dt><span class="term">
<span class="strong"><strong>-n, --nfiles</strong></span> [+-=]<span class="emphasis"><em>INT</em></span>|~<span class="emphasis"><em>BITMAP</em></span>
</span></dt><dd>
    output positions present in this many (=), this many or more (+), this
    many or fewer (-), or the exact same (~) files
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>.  When several files are being
    output, their names are controlled via <span class="strong"><strong>-p</strong></span> instead.
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-p, --prefix</strong></span> <span class="emphasis"><em>DIR</em></span>
</span></dt><dd>
    if given, subset each of the input files accordingly. See also <span class="strong"><strong>-w</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-w, --write</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    list of input files to output given as 1-based indices. With <span class="strong"><strong>-p</strong></span> and no
    <span class="strong"><strong>-w</strong></span>, all files are written.
</dd></dl></div><div class="refsect3" title="Examples:"><a id="_examples"></a><h4>Examples:</h4><p>Create intersection and complements of two sets saving the output in dir/*</p><pre class="screen">    bcftools isec -p dir A.vcf.gz B.vcf.gz</pre><p>Filter sites in A (require INFO/MAF&gt;=0.01) and B (require INFO/dbSNP) but not in C,
and create an intersection, including only sites which appear in at least two of
the files after filters have been applied</p><pre class="screen">    bcftools isec -e'MAF&lt;0.01' -i'dbSNP=1' -e- A.vcf.gz B.vcf.gz C.vcf.gz -n +2 -p dir</pre><p>Extract and write records from A shared by both A and B using exact allele match</p><pre class="screen">    bcftools isec -p dir -n=2 -w1 A.vcf.gz B.vcf.gz</pre><p>Extract records private to A or B comparing by position only</p><pre class="screen">    bcftools isec -p dir -n-1 -c all A.vcf.gz B.vcf.gz</pre><p>Print a list of records which are present in A and B but not in C and D</p><pre class="screen">    bcftools isec -n~1100 -c all A.vcf.gz B.vcf.gz C.vcf.gz D.vcf.gz</pre></div></div><div class="refsect2" title="bcftools merge [OPTIONS] A.vcf.gz B.vcf.gz […]"><a id="merge"></a><h3>bcftools merge [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>A.vcf.gz</em></span> <span class="emphasis"><em>B.vcf.gz</em></span> […]</h3><p>Merge multiple VCF/BCF files from non-overlapping sample sets to create one
multi-sample file.  For example, when merging file <span class="emphasis"><em>A.vcf.gz</em></span> containing
samples <span class="emphasis"><em>S1</em></span>, <span class="emphasis"><em>S2</em></span> and <span class="emphasis"><em>S3</em></span> and file <span class="emphasis"><em>B.vcf.gz</em></span> containing samples <span class="emphasis"><em>S3</em></span> and
<span class="emphasis"><em>S4</em></span>, the output file will contain four samples named <span class="emphasis"><em>S1</em></span>, <span class="emphasis"><em>S2</em></span>, <span class="emphasis"><em>S3</em></span>, <span class="emphasis"><em>2:S3</em></span>
and <span class="emphasis"><em>S4</em></span>.</p><p>Note that it is responsibility of the user to ensure that the sample names are
unique across all files. If they are not, the program will exit with an error
unless the option <span class="strong"><strong>--force-samples</strong></span> is given.  The sample names can be
also given explicitly using the <span class="strong"><strong>--print-header</strong></span> and <span class="strong"><strong>--use-header</strong></span> options.</p><p>Note that only records from different files can be merged, never from the same file.
For "vertical" merge take a look at <span class="strong"><strong><a class="link" href="#concat" title="bcftools concat [OPTIONS] FILE1 FILE2 […]">bcftools concat</a></strong></span> or <span class="strong"><strong><a class="link" href="#norm" title="bcftools norm [OPTIONS] file.vcf.gz">bcftools norm</a> -m</strong></span> instead.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--force-samples</strong></span>
</span></dt><dd>
    if the merged files contain duplicate samples names, proceed anyway.
    Duplicate sample names will be resolved by prepending the index of the file
    as it appeared on the command line to the conflicting sample name (see
    <span class="emphasis"><em>2:S3</em></span> in the above example).
</dd><dt><span class="term">
<span class="strong"><strong>--print-header</strong></span>
</span></dt><dd>
    print only merged header and exit
</dd><dt><span class="term">
<span class="strong"><strong>--use-header</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    use the VCF header in the provided text <span class="emphasis"><em>FILE</em></span>
</dd><dt><span class="term">
<span class="strong"><strong>-0  --missing-to-ref</strong></span>
</span></dt><dd>
    assume genotypes at missing sites are 0/0
</dd><dt><span class="term">
<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-F, --filter-logic</strong></span> <span class="emphasis"><em>x</em></span>|<span class="emphasis"><em>+</em></span>
</span></dt><dd>
    Set the output record to PASS if any of the inputs is PASS (<span class="emphasis"><em>x</em></span>),
    or apply all filters (<span class="emphasis"><em>+</em></span>), which is the default.
</dd><dt><span class="term">
<span class="strong"><strong>-g, --gvcf</strong></span> <span class="emphasis"><em>-</em></span>|<span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    merge gVCF blocks, INFO/END tag is expected. If the reference fasta
    file <span class="emphasis"><em>FILE</em></span> is not given and the dash (<span class="emphasis"><em>-</em></span>) is given, unknown reference
    bases generated at gVCF block splits will be substituted with N’s.
    The <span class="strong"><strong>--gvcf</strong></span> option uses the following default INFO rules:
    <span class="strong"><strong>-i QS:sum,MinDP:min,I16:sum,IDV:max,IMF:max</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-i, --info-rules</strong></span> <span class="emphasis"><em>-</em></span>|<span class="emphasis"><em>TAG:METHOD</em></span>[,…]
</span></dt><dd>
    Rules for merging INFO fields (scalars or vectors) or <span class="emphasis"><em>-</em></span> to disable the
    default rules. <span class="emphasis"><em>METHOD</em></span> is one of <span class="emphasis"><em>sum</em></span>, <span class="emphasis"><em>avg</em></span>, <span class="emphasis"><em>min</em></span>, <span class="emphasis"><em>max</em></span>, <span class="emphasis"><em>join</em></span>.
    Default is <span class="emphasis"><em>DP:sum,DP4:sum</em></span> if these fields exist in the input files.
    Fields with no specified rule will take the value from the first input file.
    The merged QUAL value is currently set to the maximum. This behaviour is
    not user controllable at the moment.
</dd><dt><span class="term">
<span class="strong"><strong>-l, --file-list</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Read file names from <span class="emphasis"><em>FILE</em></span>, one file name per line.
</dd><dt><span class="term">
<span class="strong"><strong>-L, --local-alleles</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Sites with many alternate alleles can require extremely large storage space which
    can exceed the 2GB size limit representable by BCF. This is caused
    by Number=G tags (such as FORMAT/PL) which store a value for each combination of reference
    and alternate alleles. The <span class="strong"><strong>-L, --local-alleles</strong></span> option allows to replace such tags
    with a localized tag (FORMAT/LPL) which only includes a subset of alternate alleles relevant
    for that sample. A new FORMAT/LAA tag is added which lists 1-based indices of the
    alternate alleles relevant (local) for the current sample. The number <span class="emphasis"><em>INT</em></span> gives the
    maximum number of alternate alleles that can be included in the PL tag. The default value
    is 0 which disables the feature and outputs values for all alternate alleles.
</dd><dt><span class="term">
<span class="strong"><strong>-m, --merge</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>none</em></span>|<span class="emphasis"><em>id</em></span>
</span></dt><dd>
    The option controls what types of multiallelic records can be created:
</dd></dl></div><pre class="screen">-m none   ..  no new multiallelics, output multiple records instead
-m snps   ..  allow multiallelic SNP records
-m indels ..  allow multiallelic indel records
-m both   ..  both SNP and indel records can be multiallelic
-m all    ..  SNP records can be merged with indel records
-m id     ..  merge by ID</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--no-index</strong></span>
</span></dt><dd>
    the option allows to merge files without indexing them first. In order for this
    option to work, the user must ensure that the input files have chromosomes in
    the same order and consistent with the order of sequences in the VCF header.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect2" title="bcftools mpileup [OPTIONS] -f ref.fa in.bam [in2.bam […]]"><a id="mpileup"></a><h3>bcftools mpileup [<span class="emphasis"><em>OPTIONS</em></span>] <span class="strong"><strong>-f</strong></span> <span class="emphasis"><em>ref.fa</em></span> <span class="emphasis"><em>in.bam</em></span> [<span class="emphasis"><em>in2.bam</em></span> […]]</h3><p>Generate VCF or BCF containing genotype likelihoods for one or multiple
alignment (BAM or CRAM) files. This is based on the original
<span class="strong"><strong>samtools mpileup</strong></span> command (with the <span class="strong"><strong>-v</strong></span> or <span class="strong"><strong>-g</strong></span> options) producing
genotype likelihoods in VCF or BCF format, but not the textual pileup
output. The <span class="strong"><strong>mpileup</strong></span> command was transferred to bcftools in order to
avoid errors resulting from use of incompatible versions of samtools
and bcftools when using in the mpileup+bcftools call pipeline.</p><p>Individuals are identified from the SM tags in the @RG header lines.  Multiple
individuals can be pooled in one alignment file, also one individual can be
separated into multiple files.  If sample identifiers are absent, each input
file is regarded as one sample.</p><p>Note that there are two orthogonal ways to specify locations in the
input file; via <span class="strong"><strong>-r</strong></span> <span class="emphasis"><em>region</em></span> and <span class="strong"><strong>-t</strong></span> <span class="emphasis"><em>positions</em></span>.  The
former uses (and requires) an index to do random access while the
latter streams through the file contents filtering out the specified
regions, requiring no index.  The two may be used in conjunction.  For
example a BED file containing locations of genes in chromosome 20
could be specified using <span class="strong"><strong>-r 20 -t chr20.bed</strong></span>, meaning that the
index is used to find chromosome 20 and then it is filtered for the
regions listed in the BED file. Also note that the <span class="strong"><strong>-r</strong></span> option can be much
slower than <span class="strong"><strong>-t</strong></span> with many regions and can require more memory when
multiple regions and many alignment files are processed.</p><div class="refsect3" title="Input options"><a id="_input_options"></a><h4>Input options</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-6, --illumina1.3+</strong></span>
</span></dt><dd>
    Assume the quality is in the Illumina 1.3+ encoding.
</dd><dt><span class="term">
<span class="strong"><strong>-A, --count-orphans</strong></span>
</span></dt><dd>
    Do not skip anomalous read pairs in variant calling.
</dd><dt><span class="term">
<span class="strong"><strong>-b, --bam-list</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    List of input alignment files, one file per line [null]
</dd><dt><span class="term">
<span class="strong"><strong>-B, --no-BAQ</strong></span>
</span></dt><dd>
    Disable probabilistic realignment for the computation of base alignment
    quality (BAQ). BAQ is the Phred-scaled probability of a read base being
    misaligned. Applying this option greatly helps to reduce false SNPs caused
    by misalignments.
</dd><dt><span class="term">
<span class="strong"><strong>-C, --adjust-MQ</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Coefficient  for  downgrading mapping quality for reads containing
    excessive mismatches. Given a read with a phred-scaled probability q of
    being generated from the mapped position, the new mapping quality is
    about sqrt((INT-q)/INT)*INT. A zero value disables this functionality; if
    enabled, the recommended value for BWA is 50. [0]
</dd><dt><span class="term">
<span class="strong"><strong>-d, --max-depth</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    At a position, read maximally <span class="emphasis"><em>INT</em></span> reads per input file. Note that
    the original <span class="strong"><strong>samtools mpileup</strong></span> command had a minimum value of <span class="emphasis"><em>8000/n</em></span>
    where <span class="emphasis"><em>n</em></span> was the number of input files given to mpileup. This means that
    in <span class="strong"><strong>samtools mpileup</strong></span> the default was highly likely to be increased and the
    <span class="strong"><strong>-d</strong></span> parameter would have an effect only once above the cross-sample minimum of 8000.
    This behavior was problematic when working with a combination of
    single- and multi-sample bams, therefore in <span class="strong"><strong>bcftools mpileup</strong></span> the user
    is given the full control (and responsibility), and an informative message
    is printed instead [250]
</dd><dt><span class="term">
<span class="strong"><strong>-E, --redo-BAQ</strong></span>
</span></dt><dd>
    Recalculate BAQ on the fly, ignore existing BQ tags
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    The <span class="strong"><strong>faidx</strong></span>-indexed reference file in the FASTA format. The file can be
    optionally compressed by <span class="strong"><strong>bgzip</strong></span>. Reference is required by default
    unless the <span class="strong"><strong>--no-reference</strong></span> option is set [null]
</dd><dt><span class="term">
<span class="strong"><strong>--no-reference</strong></span>
</span></dt><dd>
    Do not require the <span class="strong"><strong>--fasta-ref</strong></span> option.
</dd><dt><span class="term">
<span class="strong"><strong>-G, --read-groups</strong></span> <span class="emphasis"><em><span class="^">FILE</span></em></span>
</span></dt><dd>
    list of read groups to include or exclude if prefixed with "^".
    One read group per line.  This file can also be used to assign new sample
    names to read groups by giving the new sample name as a second
    white-space-separated field, like this: "read_group_id new_sample_name".
    If the read group name is not unique, also the bam file name can
    be included: "read_group_id file_name sample_name".  If all
    reads from the alignment file should be treated as a single sample, the
    asterisk symbol can be used: "* file_name sample_name". Alignments without
    a read group ID can be matched with "?". <span class="strong"><strong>NOTE:</strong></span> The meaning of <span class="strong"><strong>bcftools mpileup -G</strong></span>
    is the opposite of <span class="strong"><strong>samtools mpileup -G</strong></span>.
</dd></dl></div><pre class="screen">    RG_ID_1
    RG_ID_2  SAMPLE_A
    RG_ID_3  SAMPLE_A
    RG_ID_4  SAMPLE_B
    RG_ID_5  FILE_1.bam  SAMPLE_A
    RG_ID_6  FILE_2.bam  SAMPLE_A
    *        FILE_3.bam  SAMPLE_C
    ?        FILE_3.bam  SAMPLE_D</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-q, -min-MQ</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Minimum mapping quality for an alignment to be used [0]
</dd><dt><span class="term">
<span class="strong"><strong>-Q, --min-BQ</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Minimum base quality for a base to be considered [13]
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>CHR</em></span>|<span class="emphasis"><em>CHR:POS</em></span>|<span class="emphasis"><em>CHR:FROM-TO</em></span>|<span class="emphasis"><em>CHR:FROM-</em></span>[,…]
</span></dt><dd>
    Only generate mpileup output in given regions. Requires the alignment files
    to be indexed.  If used in conjunction with -l then considers the intersection;
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    As for <span class="strong"><strong>-r, --regions</strong></span>, but regions read from FILE;
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--ignore-RG</strong></span>
</span></dt><dd>
    Ignore RG tags. Treat all reads in one alignment file as one sample.
</dd><dt><span class="term">
<span class="strong"><strong>--rf, --incl-flags</strong></span> <span class="emphasis"><em>STR</em></span>|<span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Required flags: skip reads with mask bits unset  [null]
</dd><dt><span class="term">
<span class="strong"><strong>--ff, --excl-flags</strong></span> <span class="emphasis"><em>STR</em></span>|<span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Filter flags: skip reads with mask bits set [UNMAP,SECONDARY,QCFAIL,DUP]
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em><span class="^">LIST</span></em></span>
</span></dt><dd>
    list of sample names. See <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em><span class="^">FILE</span></em></span>
</span></dt><dd>
    file of sample names to include or exclude if prefixed with "^".
    One sample per line. This file can also be used to rename samples by giving
    the new sample name as a second white-space-separated column, like this:
    "old_name new_name".  If a sample name contains spaces, the spaces can be
    escaped using the backslash character, for example "Not\ a\ good\ sample\
    name".
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-x, --ignore-overlaps</strong></span>
</span></dt><dd>
    Disable read-pair overlap detection.
</dd></dl></div></div><div class="refsect3" title="Output options"><a id="_output_options"></a><h4>Output options</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-a, --annotate</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    Comma-separated list of FORMAT and INFO tags to output. (case-insensitive,
    the "FORMAT/" prefix is optional, and use "?" to list available annotations
    on the command line) [null]:
</dd></dl></div><pre class="screen">FORMAT/AD   .. Allelic depth (Number=R,Type=Integer)
FORMAT/ADF  .. Allelic depths on the forward strand (Number=R,Type=Integer)
FORMAT/ADR  .. Allelic depths on the reverse strand (Number=R,Type=Integer)
FORMAT/DP   .. Number of high-quality bases (Number=1,Type=Integer)
FORMAT/SP   .. Phred-scaled strand bias P-value (Number=1,Type=Integer)
FORMAT/SCR  .. Number of soft-clipped reads (Number=1,Type=Integer)

INFO/AD     .. Total allelic depth (Number=R,Type=Integer)
INFO/ADF    .. Total allelic depths on the forward strand (Number=R,Type=Integer)
INFO/ADR    .. Total allelic depths on the reverse strand (Number=R,Type=Integer)
INFO/SCR    .. Number of soft-clipped reads (Number=1,Type=Integer)

FORMAT/DV   .. Deprecated in favor of FORMAT/AD; Number of high-quality non-reference bases, (Number=1,Type=Integer)
FORMAT/DP4  .. Deprecated in favor of FORMAT/ADF and FORMAT/ADR; Number of high-quality ref-forward, ref-reverse,
               alt-forward and alt-reverse bases (Number=4,Type=Integer)
FORMAT/DPR  .. Deprecated in favor of FORMAT/AD; Number of high-quality bases for each observed allele (Number=R,Type=Integer)
INFO/DPR    .. Deprecated in favor of INFO/AD; Number of high-quality bases for each observed allele (Number=R,Type=Integer)</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-g, --gvcf</strong></span> <span class="emphasis"><em>INT</em></span>[,…]
</span></dt><dd>
    output gVCF blocks of homozygous REF calls, with depth (DP) ranges
    specified by the list of integers. For example, passing <span class="emphasis"><em>5,15</em></span> will
    group sites into two types of gVCF blocks, the first with minimum
    per-sample DP from the interval [5,15) and the latter with minimum
    depth 15 or more. In this example, sites with minimum per-sample
    depth less than 5 will be printed as separate records, outside of
    gVCF blocks.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Write output to <span class="emphasis"><em>FILE</em></span>, rather than the default of standard output.
    (The same short option is used for both <span class="strong"><strong>--open-prob</strong></span> and <span class="strong"><strong>--output</strong></span>.  If <span class="strong"><strong>-o</strong></span>'s
    argument contains any non-digit characters other than a leading + or -
    sign,  it  is  interpreted  as <span class="strong"><strong>--output</strong></span>.  Usually the filename extension
    will take care of this, but to write to an entirely numeric filename use <span class="strong"><strong>-o
    ./123</strong></span> or <span class="strong"><strong>--output 123</strong></span>.)
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="Options for SNP/INDEL genotype likelihood computation"><a id="_options_for_snp_indel_genotype_likelihood_computation"></a><h4>Options for SNP/INDEL genotype likelihood computation</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-e, --ext-prob</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Phred-scaled gap extension sequencing error probability. Reducing <span class="emphasis"><em>INT</em></span>
    leads to longer indels [20]
</dd><dt><span class="term">
<span class="strong"><strong>-F, --gap-frac</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    Minimum fraction of gapped reads [0.002]
</dd><dt><span class="term">
<span class="strong"><strong>-h, --tandem-qual</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Coefficient for modeling homopolymer errors. Given an <span class="emphasis"><em>l</em></span>-long homopolymer
    run, the sequencing error of an indel of size s is modeled as <span class="emphasis"><em>INT</em></span>*s/l [100]
</dd><dt><span class="term">
<span class="strong"><strong>-I, --skip-indels</strong></span>
</span></dt><dd>
    Do not perform INDEL calling
</dd><dt><span class="term">
<span class="strong"><strong>-L, --max-idepth</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Skip INDEL calling if the average per-sample depth is above <span class="emphasis"><em>INT</em></span> [250]
</dd><dt><span class="term">
<span class="strong"><strong>-m, --min-ireads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Minimum number gapped reads for indel candidates <span class="emphasis"><em>INT</em></span> [1]
</dd><dt><span class="term">
<span class="strong"><strong>-o, --open-prob</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    Phred-scaled gap open sequencing error probability. Reducing <span class="emphasis"><em>INT</em></span> leads
    to more indel calls. (The same short option is used for both <span class="strong"><strong>--open-prob</strong></span>
    and <span class="strong"><strong>--output</strong></span>.  When -o’s argument contains only an optional + or - sign
    followed by the digits 0 to 9, it is interpreted  as <span class="strong"><strong>--open-prob</strong></span>.) [40]
</dd><dt><span class="term">
<span class="strong"><strong>-p, --per-sample-mF</strong></span>
</span></dt><dd>
    Apply <span class="strong"><strong>-m</strong></span> and <span class="strong"><strong>-F</strong></span> thresholds per sample to increase sensitivity of calling.
    By default both options are applied to reads pooled from all samples.
</dd><dt><span class="term">
<span class="strong"><strong>-P, --platforms</strong></span> <span class="emphasis"><em>STR</em></span>
</span></dt><dd>
    Comma-delimited  list  of  platforms (determined by <span class="strong"><strong>@RG-PL</strong></span>) from which
    indel candidates are obtained. It is recommended to collect indel
    candidates from sequencing technologies that have low indel error rate
    such as ILLUMINA [all]
</dd></dl></div></div><div class="refsect3" title="Examples:"><a id="_examples_2"></a><h4>Examples:</h4><p>Call SNPs and short INDELs, then mark low quality sites and sites with the read
depth exceeding a limit. (The read depth should be adjusted to about twice the
average read depth as higher read depths usually indicate problematic regions
which are often enriched for artefacts.) One may consider to add <span class="strong"><strong>-C50</strong></span> to
mpileup if mapping quality is overestimated  for reads containing  excessive
mismatches.  Applying this option usually helps for BWA-backtrack alignments,
but may not other aligners.</p><pre class="screen">    bcftools mpileup -Ou -f ref.fa aln.bam | \
    bcftools call -Ou -mv | \
    bcftools filter -s LowQual -e '%QUAL&lt;20 || DP&gt;100' &gt; var.flt.vcf</pre></div></div><div class="refsect2" title="bcftools norm [OPTIONS] file.vcf.gz"><a id="norm"></a><h3>bcftools norm [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>Left-align and normalize indels, check if REF alleles match the reference,
split multiallelic sites into multiple rows; recover multiallelics from
multiple rows. Left-alignment and normalization will only be applied if
the <span class="strong"><strong><a class="link" href="#fasta_ref">--fasta-ref</a></strong></span> option is supplied.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --check-ref</strong></span> <span class="emphasis"><em>e</em></span>|<span class="emphasis"><em>w</em></span>|<span class="emphasis"><em>x</em></span>|<span class="emphasis"><em>s</em></span>
</span></dt><dd>
    what to do when incorrect or missing REF allele is encountered:
    exit (<span class="emphasis"><em>e</em></span>), warn (<span class="emphasis"><em>w</em></span>), exclude (<span class="emphasis"><em>x</em></span>), or set/fix (<span class="emphasis"><em>s</em></span>) bad sites.
    The <span class="emphasis"><em>w</em></span> option can be combined with <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>s</em></span>. Note that <span class="emphasis"><em>s</em></span>
    can swap alleles and will update genotypes (GT) and AC counts,
    but will not attempt to fix PL or other fields. Also note, and this
    cannot be stressed enough, that <span class="emphasis"><em>s</em></span> will NOT fix strand issues in
    your VCF, do NOT use it for that purpose!!! (Instead see
    <a class="ulink" href="http://samtools.github.io/bcftools/howtos/plugin.af-dist.html" target="_top">http://samtools.github.io/bcftools/howtos/plugin.af-dist.html</a> and
    <a class="ulink" href="http://samtools.github.io/bcftools/howtos/plugin.fixref.html" target="_top">http://samtools.github.io/bcftools/howtos/plugin.fixref.html</a>.)
</dd><dt><span class="term">
<span class="strong"><strong>-d, --rm-dup</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>exact</em></span>
</span></dt><dd>
    If a record is present multiple times, output only the first instance.
    See also <span class="strong"><strong>--collapse</strong></span> in <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-D, --remove-duplicates</strong></span>
</span></dt><dd>
    If a record is present in multiple files, output only the first instance.
    Alias for <span class="strong"><strong>-d none</strong></span>, deprecated.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>FILE</em></span><a id="fasta_ref"></a>
</span></dt><dd>
    reference sequence. Supplying this option will turn on left-alignment
    and normalization, however, see also the <span class="strong"><strong><a class="link" href="#do_not_normalize">--do-not-normalize</a></strong></span>
    option below.
</dd><dt><span class="term">
<span class="strong"><strong>--force</strong></span>
</span></dt><dd>
    try to proceed with <span class="strong"><strong>-m-</strong></span> even if malformed tags with incorrect number of fields
    are encountered, discarding such tags. (Experimental, use at your own risk.)
</dd><dt><span class="term">
<span class="strong"><strong>--keep-sum</strong></span> <span class="emphasis"><em>TAG</em></span>[,…]
</span></dt><dd>
    keep vector sum constant when splitting multiallelic sites. Only AD tag
    is currently supported. See also <a class="ulink" href="https://github.com/samtools/bcftools/issues/360" target="_top">https://github.com/samtools/bcftools/issues/360</a>
</dd><dt><span class="term">
<span class="strong"><strong>-m, --multiallelics</strong></span> <span class="strong"><strong>-</strong></span>|<span class="strong"><strong>+</strong></span>[<span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>any</em></span>]
</span></dt><dd>
    split multiallelic sites into biallelic records (<span class="strong"><strong>-</strong></span>) or join
    biallelic sites into multiallelic records (<span class="strong"><strong>+</strong></span>). An optional type string
    can follow which controls variant types which should be split or merged
    together: If only SNP records should be split or merged, specify <span class="emphasis"><em>snps</em></span>; if
    both SNPs and indels should be merged separately into two records, specify
    <span class="emphasis"><em>both</em></span>; if SNPs and indels should be merged into a single record, specify
    <span class="emphasis"><em>any</em></span>.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-N, --do-not-normalize</strong></span><a id="do_not_normalize"></a>
</span></dt><dd>
    the <span class="emphasis"><em>-c s</em></span> option can be used to fix or set the REF allele from the
    reference <span class="emphasis"><em>-f</em></span>. The <span class="emphasis"><em>-N</em></span> option will not turn on indel normalisation
    as the <span class="emphasis"><em>-f</em></span> option normally implies
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --strict-filter</strong></span>
</span></dt><dd>
    when merging (<span class="emphasis"><em>-m+</em></span>), merged site is PASS only if all sites being merged PASS
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-w, --site-win</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    maximum distance between two records to consider when locally
    sorting variants which changed position during the realignment
</dd></dl></div></div><div class="refsect2" title="bcftools [plugin NAME|+NAME] [OPTIONS] FILE — [PLUGIN OPTIONS]"><a id="plugin"></a><h3>bcftools [plugin <span class="emphasis"><em>NAME</em></span>|+<span class="emphasis"><em>NAME</em></span>] <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span> — <span class="emphasis"><em>[PLUGIN OPTIONS]</em></span></h3><p>A common framework for various utilities. The plugins can be used
the same way as normal commands only their name is prefixed with "+".
Most plugins accept two types of parameters: general options shared by all
plugins followed by a separator, and a list of plugin-specific options.  There
are some exceptions to this rule, some plugins do not accept the common
options and implement their own parameters. Therefore please pay attention to
the usage examples that each plugin comes with.</p><div class="refsect3" title="VCF input options:"><a id="_vcf_input_options_2"></a><h4>VCF input options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="VCF output options:"><a id="_vcf_output_options_2"></a><h4>VCF output options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="Plugin options:"><a id="_plugin_options"></a><h4>Plugin options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-h, --help</strong></span>
</span></dt><dd>
    list plugin’s options
</dd><dt><span class="term">
<span class="strong"><strong>-l, --list-plugins</strong></span>
</span></dt><dd><p class="simpara">
    List all available plugins.
</p><p class="simpara">By default, appropriate system directories are searched for installed plugins.
    You can override this by setting the BCFTOOLS_PLUGINS environment variable
    to a colon-separated list of directories to search.
    If BCFTOOLS_PLUGINS begins with a colon, ends with a colon, or contains
    adjacent colons, the system directories are also searched at that position
    in the list of directories.</p></dd><dt><span class="term">
<span class="strong"><strong>-v, --verbose</strong></span>
</span></dt><dd>
    print debugging information to debug plugin failure
</dd><dt><span class="term">
<span class="strong"><strong>-V, --version</strong></span>
</span></dt><dd>
    print version string and exit
</dd></dl></div></div><div class="refsect3" title="List of plugins coming with the distribution:"><a id="_list_of_plugins_coming_with_the_distribution"></a><h4>List of plugins coming with the distribution:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>ad-bias</strong></span>
</span></dt><dd>
    find positions with wildly varying ALT allele frequency (Fisher test on FMT/AD)
</dd><dt><span class="term">
<span class="strong"><strong>add-variantkey</strong></span>
</span></dt><dd>
    add VariantKey INFO fields VKX and RSX
</dd><dt><span class="term">
<span class="strong"><strong>af-dist</strong></span>
</span></dt><dd>
    collect AF deviation stats and GT probability distribution given AF and assuming HWE
</dd><dt><span class="term">
<span class="strong"><strong>allele-length</strong></span>
</span></dt><dd>
    count the frequency of the length of REF, ALT and REF+ALT
</dd><dt><span class="term">
<span class="strong"><strong>check-ploidy</strong></span>
</span></dt><dd>
    check if ploidy of samples is consistent for all sites
</dd><dt><span class="term">
<span class="strong"><strong>check-sparsity</strong></span>
</span></dt><dd>
    print samples without genotypes in a region or chromosome
</dd><dt><span class="term">
<span class="strong"><strong>color-chrs</strong></span>
</span></dt><dd>
    color shared chromosomal segments, requires trio VCF with phased GTs
</dd><dt><span class="term">
<span class="strong"><strong>contrast</strong></span>
</span></dt><dd><p class="simpara">
    runs a basic association test, per-site or in a region, and checks for novel alleles and
    genotypes in two groups of samples. Adds the following INFO annotations:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
PASSOC  .. Fisher’s exact test probability of genotypic association (REF vs non-REF allele)
</li><li class="listitem">
FASSOC  .. proportion of non-REF allele in controls and cases
</li><li class="listitem">
NASSOC  .. number of control-ref, control-alt, case-ref and case-alt alleles
</li><li class="listitem">
NOVELAL .. lists samples with a novel allele not observed in the control group
</li><li class="listitem">
NOVELGT .. lists samples with a novel genotype not observed in the control group
</li></ul></div></dd><dt><span class="term">
<span class="strong"><strong>counts</strong></span>
</span></dt><dd>
    a minimal plugin which counts number of SNPs, Indels, and total number of sites.
</dd><dt><span class="term">
<span class="strong"><strong>dosage</strong></span>
</span></dt><dd>
    print genotype dosage. By default the plugin searches for PL, GL and GT, in
    that order.
</dd><dt><span class="term">
<span class="strong"><strong>fill-from-fasta</strong></span>
</span></dt><dd>
    fill INFO or REF field based on values in a fasta file
</dd><dt><span class="term">
<span class="strong"><strong>fill-tags</strong></span>
</span></dt><dd><p class="simpara">
    set various INFO tags. The list of tags supported in this version:
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
INFO/AC         Number:A  Type:Integer  ..  Allele count in genotypes
</li><li class="listitem">
INFO/AC_Hom     Number:A  Type:Integer  ..  Allele counts in homozygous genotypes
</li><li class="listitem">
INFO/AC_Het     Number:A  Type:Integer  ..  Allele counts in heterozygous genotypes
</li><li class="listitem">
INFO/AC_Hemi    Number:A  Type:Integer  ..  Allele counts in hemizygous genotypes
</li><li class="listitem">
INFO/AF         Number:A  Type:Float    ..  Allele frequency
</li><li class="listitem">
INFO/AN         Number:1  Type:Integer  ..  Total number of alleles in called genotypes
</li><li class="listitem">
INFO/ExcHet     Number:A  Type:Float    ..  Test excess heterozygosity; 1=good, 0=bad
</li><li class="listitem">
INFO/END        Number:1  Type:Integer  ..  End position of the variant
</li><li class="listitem">
INFO/F_MISSING  Number:1  Type:Float    ..  Fraction of missing genotypes
</li><li class="listitem">
INFO/HWE        Number:A  Type:Float    ..  HWE test (PMID:15789306); 1=good, 0=bad
</li><li class="listitem">
INFO/MAF        Number:A  Type:Float    ..  Minor Allele frequency
</li><li class="listitem">
INFO/NS         Number:1  Type:Integer  ..  Number of samples with data
</li><li class="listitem">
INFO/TYPE       Number:.  Type:String   ..  The record type (REF,SNP,MNP,INDEL,etc)
</li><li class="listitem">
TAG=func(TAG)   Number:1  Type:Integer  ..  Experimental support for user-defined expressions such as "DP=sum(DP)"
</li></ul></div></dd><dt><span class="term">
<span class="strong"><strong>fix-ploidy</strong></span>
</span></dt><dd>
    sets correct ploidy
</dd><dt><span class="term">
<span class="strong"><strong>fixref</strong></span>
</span></dt><dd>
    determine and fix strand orientation
</dd><dt><span class="term">
<span class="strong"><strong>frameshifts</strong></span>
</span></dt><dd>
    annotate frameshift indels
</dd><dt><span class="term">
<span class="strong"><strong>GTisec</strong></span>
</span></dt><dd>
    count genotype intersections across all possible sample subsets in a vcf file
</dd><dt><span class="term">
<span class="strong"><strong>GTsubset</strong></span>
</span></dt><dd>
    output only sites where the requested samples all exclusively share a genotype
</dd><dt><span class="term">
<span class="strong"><strong>guess-ploidy</strong></span>
</span></dt><dd>
    determine sample sex by checking genotype likelihoods (GL,PL) or genotypes (GT)
    in the non-PAR region of chrX.
</dd><dt><span class="term">
<span class="strong"><strong>gvcfz</strong></span>
</span></dt><dd>
    compress gVCF file by resizing non-variant blocks according to specified criteria
</dd><dt><span class="term">
<span class="strong"><strong>impute-info</strong></span>
</span></dt><dd>
    add imputation information metrics to the INFO field based on selected FORMAT tags
</dd><dt><span class="term">
<span class="strong"><strong>indel-stats</strong></span>
</span></dt><dd>
    calculates per-sample or de novo indels stats. The usage and format is similar
    to <span class="strong"><strong>smpl-stats</strong></span> and <span class="strong"><strong>trio-stats</strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>isecGT</strong></span>
</span></dt><dd>
    compare two files and set non-identical genotypes to missing
</dd><dt><span class="term">
<span class="strong"><strong>mendelian</strong></span>
</span></dt><dd>
    count Mendelian consistent / inconsistent genotypes.
</dd><dt><span class="term">
<span class="strong"><strong>missing2ref</strong></span>
</span></dt><dd>
    sets missing genotypes ("./.") to ref allele ("0/0" or "0|0")
</dd><dt><span class="term">
<span class="strong"><strong>parental-origin</strong></span>
</span></dt><dd>
    determine parental origin of a CNV region
</dd><dt><span class="term">
<span class="strong"><strong>prune</strong></span>
</span></dt><dd>
    prune sites by missingness, allele frequency or linkage disequilibrium.
    Alternatively, annotate sites with r2, Lewontin’s D' (PMID:19433632), Ragsdale’s D (PMID:31697386).
</dd><dt><span class="term">
<span class="strong"><strong>remove-overlaps</strong></span>
</span></dt><dd>
    remove overlapping variants and duplicate sites
</dd><dt><span class="term">
<span class="strong"><strong>scatter</strong></span>
</span></dt><dd>
    intended as an inverse to <code class="literal">bcftools concat</code>, scatter VCF by chunks or regions, creating multiple VCFs.
</dd><dt><span class="term">
<span class="strong"><strong>setGT</strong></span>
</span></dt><dd>
    general tool to set genotypes according to rules requested by the user
</dd><dt><span class="term">
<span class="strong"><strong>smpl-stats</strong></span>
</span></dt><dd>
    calculates basic per-sample stats. The usage and format is similar to
    <span class="strong"><strong>indel-stats</strong></span> and <span class="strong"><strong>trio-stats</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>split</strong></span>
</span></dt><dd>
    split VCF by sample, creating single- or multi-sample VCFs
</dd><dt><span class="term">
<span class="strong"><strong>split-vep</strong></span>
</span></dt><dd>
    extract fields from structured annotations such as INFO/CSQ created by bcftools/csq or VEP. These
    can be added as a new INFO field to the VCF or in a custom text format. See
    <a class="ulink" href="http://samtools.github.io/bcftools/howtos/plugin.split-vep.html" target="_top">http://samtools.github.io/bcftools/howtos/plugin.split-vep.html</a> for more.
</dd><dt><span class="term">
<span class="strong"><strong>tag2tag</strong></span>
</span></dt><dd>
    convert between similar tags, such as GL and GP
</dd><dt><span class="term">
<span class="strong"><strong>trio-dnm</strong></span>
</span></dt><dd>
    screen variants for possible de-novo mutations in trios
</dd><dt><span class="term">
<span class="strong"><strong>trio-stats</strong></span>
</span></dt><dd>
    calculate transmission rate in trio children. The usage and format is similar to
    <span class="strong"><strong>indel-stats</strong></span> and <span class="strong"><strong>smpl-stats</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>trio-switch-rate</strong></span>
</span></dt><dd>
    calculate phase switch rate in trio samples, children samples must have phased GTs
</dd><dt><span class="term">
<span class="strong"><strong>variantkey-hex</strong></span>
</span></dt><dd>
    generate unsorted VariantKey-RSid index files in hexadecimal format
</dd></dl></div></div><div class="refsect3" title="Examples:"><a id="_examples_3"></a><h4>Examples:</h4><pre class="screen"># List options common to all plugins
bcftools plugin

# List available plugins
bcftools plugin -l

# Run a plugin
bcftools plugin counts in.vcf

# Run a plugin using the abbreviated "+" notation
bcftools +counts in.vcf

# Run a plugin from an explicit location
bcftools +/path/to/counts.so in.vcf

# The input VCF can be streamed just like in other commands
cat in.vcf | bcftools +counts

# Print usage information of plugin "dosage"
bcftools +dosage -h

# Replace missing genotypes with 0/0
bcftools +missing2ref in.vcf

# Replace missing genotypes with 0|0
bcftools +missing2ref in.vcf -- -p</pre></div><div class="refsect3" title="Plugins troubleshooting:"><a id="_plugins_troubleshooting"></a><h4>Plugins troubleshooting:</h4><p>Things to check if your plugin does not show up in the <span class="strong"><strong>bcftools plugin -l</strong></span> output:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
Run with the <span class="strong"><strong>-v</strong></span> option for verbose output: <span class="strong"><strong>bcftools plugin -lv</strong></span>
</li><li class="listitem">
Does the environment variable BCFTOOLS_PLUGINS include the correct path?
</li></ul></div></div><div class="refsect3" title="Plugins API:"><a id="_plugins_api"></a><h4>Plugins API:</h4><pre class="screen">// Short description used by 'bcftools plugin -l'
const char *about(void);

// Longer description used by 'bcftools +name -h'
const char *usage(void);

// Called once at startup, allows initialization of local variables.
// Return 1 to suppress normal VCF/BCF header output, -1 on critical
// errors, 0 otherwise.
int init(int argc, char **argv, bcf_hdr_t *in_hdr, bcf_hdr_t *out_hdr);

// Called for each VCF record, return NULL to suppress the output
bcf1_t *process(bcf1_t *rec);

// Called after all lines have been processed to clean up
void destroy(void);</pre></div></div><div class="refsect2" title="bcftools polysomy [OPTIONS] file.vcf.gz"><a id="polysomy"></a><h3>bcftools polysomy [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>Detect number of chromosomal copies in VCFs annotates with the Illumina’s
B-allele frequency (BAF) values. Note that this command is not compiled
in by default, see the section <span class="strong"><strong>Optional Compilation with GSL</strong></span> in the INSTALL
file for help.</p><div class="refsect3" title="General options:"><a id="_general_options_2"></a><h4>General options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-o, --output-dir</strong></span> <span class="emphasis"><em>path</em></span>
</span></dt><dd>
    output directory
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --sample</strong></span> <span class="emphasis"><em>string</em></span>
</span></dt><dd>
    sample name
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-v, --verbose</strong></span>
</span></dt><dd>
    verbose debugging output which gives hints about the thresholds and decisions made
    by the program. Note that the exact output can change between versions.
</dd></dl></div></div><div class="refsect3" title="Algorithm options:"><a id="_algorithm_options"></a><h4>Algorithm options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-b, --peak-size</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    the minimum peak size considered as a good match can be from the interval [0,1]
    where larger is stricter
</dd><dt><span class="term">
<span class="strong"><strong>-c, --cn-penalty</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    a penalty for increasing copy number state. How this works: multiple peaks
    are always a better fit than a single peak, therefore the program prefers
    a single peak (normal copy number) unless the absolute deviation of the
    multiple peaks fit is significantly smaller. Here the meaning of
    "significant" is given by the <span class="emphasis"><em>float</em></span> from the interval [0,1] where
    larger is stricter.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --fit-th</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    threshold for goodness of fit (normalized absolute deviation), smaller is stricter
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include-aa</strong></span>
</span></dt><dd>
    include also the AA peak in CN2 and CN3 evaluation. This usually requires increasing <span class="strong"><strong>-f</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-m, --min-fraction</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    minimum distinguishable fraction of aberrant cells. The experience shows that trustworthy
    are estimates of 20% and more.
</dd><dt><span class="term">
<span class="strong"><strong>-p, --peak-symmetry</strong></span> <span class="emphasis"><em>float</em></span>
</span></dt><dd>
    a heuristics to filter failed fits where the expected peak symmetry is violated.
    The <span class="emphasis"><em>float</em></span> is from the interval [0,1] and larger is stricter
</dd></dl></div></div></div><div class="refsect2" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]"><a id="query"></a><h3>bcftools query [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span> [<span class="emphasis"><em>file.vcf.gz</em></span> […]]</h3><p>Extracts fields from VCF or BCF files and outputs them in user-defined format.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --format</strong></span> <span class="emphasis"><em>FORMAT</em></span>
</span></dt><dd>
    learn by example, see below
</dd><dt><span class="term">
<span class="strong"><strong>-H, --print-header</strong></span>
</span></dt><dd>
    print header
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-l, --list-samples</strong></span>
</span></dt><dd>
    list sample names and exit
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-u, --allow-undef-tags</strong></span>
</span></dt><dd>
    do not throw an error if there are undefined tags in the format string,
    print "." instead
</dd><dt><span class="term">
<span class="strong"><strong>-v, --vcf-list</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    process multiple VCFs listed in the file
</dd></dl></div><div class="refsect3" title="Format:"><a id="_format"></a><h4>Format:</h4><pre class="literallayout">%CHROM          The CHROM column (similarly also other columns: POS, ID, REF, ALT, QUAL, FILTER)
%END            End position of the REF allele
%END0           End position of the REF allele in 0-based coordinates
%FIRST_ALT      Alias for %ALT{0}
%FORMAT         Prints all FORMAT fields or a subset of samples with -s or -S
%GT             Genotype (e.g. 0/1)
%INFO           Prints the whole INFO column
%INFO/TAG       Any tag in the INFO column
%IUPACGT        Genotype translated to IUPAC ambiguity codes (e.g. M instead of C/A)
%LINE           Prints the whole line
%MASK           Indicates presence of the site in other files (with multiple files)
%N_PASS(expr)   Number of samples that pass the filtering expression (see *&lt;&lt;expressions,EXPRESSIONS&gt;&gt;*)
%POS0           POS in 0-based coordinates
%PBINOM(TAG)    Calculate phred-scaled binomial probability, the allele index is determined from GT
%SAMPLE         Sample name
%TAG{INT}       Curly brackets to print a subfield (e.g. INFO/TAG{1}, the indexes are 0-based)
%TBCSQ          Translated FORMAT/BCSQ. See the csq command above for explanation and examples.
%TGT            Translated genotype (e.g. C/A)
%TYPE           Variant type (REF, SNP, MNP, INDEL, BND, OTHER)
[]              Format fields must be enclosed in brackets to loop over all samples
\n              new line
\t              tab character</pre><pre class="literallayout">Everything else is printed verbatim.</pre></div><div class="refsect3" title="Examples:"><a id="_examples_4"></a><h4>Examples:</h4><pre class="literallayout"># Print chromosome, position, ref allele and the first alternate allele
bcftools query -f '%CHROM  %POS  %REF  %ALT{0}\n' file.vcf.gz</pre><pre class="literallayout"># Similar to above, but use tabs instead of spaces, add sample name and genotype
bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n' file.vcf.gz</pre><pre class="literallayout"># Print FORMAT/GT fields followed by FORMAT/GT fields
bcftools query -f 'GQ:[ %GQ] \t GT:[ %GT]\n' file.vcf</pre><pre class="literallayout"># Make a BED file: chr, pos (0-based), end pos (1-based), id
bcftools query -f'%CHROM\t%POS0\t%END\t%ID\n' file.bcf</pre><pre class="literallayout"># Print only samples with alternate (non-reference) genotypes
bcftools query -f'[%CHROM:%POS %SAMPLE %GT\n]' -i'GT="alt"' file.bcf</pre><pre class="literallayout"># Print all samples at sites with at least one alternate genotype
bcftools view -i'GT="alt"' file.bcf -Ou | bcftools query -f'[%CHROM:%POS %SAMPLE %GT\n]'</pre><pre class="literallayout"># Print phred-scaled binomial probability from FORMAT/AD tag for all heterozygous genotypes
bcftools query -i'GT="het"' -f'[%CHROM:%POS %SAMPLE %GT %pbinom(AD)\n]' file.vcf</pre><pre class="literallayout"># Print the second value of AC field if bigger than 10. Note the (unfortunate) difference in
# index subscript notation: formatting expressions (-f) uses "{}" while filtering expressions
# (-i) use "[]". This is for historic reasons and backward-compatibility.
bcftools query -f '%AC{1}\n' -i 'AC[1]&gt;10' file.vcf.gz</pre></div></div><div class="refsect2" title="bcftools reheader [OPTIONS] file.vcf.gz"><a id="reheader"></a><h3>bcftools reheader [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>Modify header of VCF/BCF files, change sample names.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-f, --fai</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    add to the header contig names and their lengths from the provided fasta index file (.fai).
    Lengths of existing contig lines will be updated and contig lines not present in
    the fai file will be removed
</dd><dt><span class="term">
<span class="strong"><strong>-h, --header</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    new VCF header
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    new sample names, one name per line, in the same order as they appear
    in the VCF file. Alternatively, only samples which need to be renamed
    can be listed as "old_name new_name\n" pairs separated by whitespaces,
    each on a separate line. If a sample name contains spaces, the
    spaces can be escaped using the backslash character, for example
    "Not\ a\ good\ sample\ name".
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect2" title="bcftools roh [OPTIONS] file.vcf.gz"><a id="roh"></a><h3>bcftools roh [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>A program for detecting runs of homo/autozygosity. Only bi-allelic sites
are considered.</p><div class="refsect3" title="The HMM model:"><a id="_the_hmm_model"></a><h4>The HMM model:</h4><pre class="screen">Notation:
  D  = Data, AZ = autozygosity, HW = Hardy-Weinberg (non-autozygosity),
  f  = non-ref allele frequency

Emission probabilities:
  oAZ = P_i(D|AZ) = (1-f)*P(D|RR) + f*P(D|AA)
  oHW = P_i(D|HW) = (1-f)^2 * P(D|RR) + f^2 * P(D|AA) + 2*f*(1-f)*P(D|RA)

Transition probabilities:
  tAZ = P(AZ|HW)  .. from HW to AZ, the -a parameter
  tHW = P(HW|AZ)  .. from AZ to HW, the -H parameter

  ci  = P_i(C)  .. probability of cross-over at site i, from genetic map
  AZi = P_i(AZ) .. probability of site i being AZ/non-AZ, scaled so that AZi+HWi = 1
  HWi = P_i(HW)

  P_{i+1}(AZ) = oAZ * max[(1 - tAZ * ci) * AZ{i-1} , tAZ * ci * (1-AZ{i-1})]
  P_{i+1}(HW) = oHW * max[(1 - tHW * ci) * (1-AZ{i-1}) , tHW * ci * AZ{i-1}]</pre></div><div class="refsect3" title="General Options:"><a id="_general_options_3"></a><h4>General Options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--AF-dflt</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    in case allele frequency is not known, use the <span class="emphasis"><em>FLOAT</em></span>. By default, sites where
    allele frequency cannot be determined, or is 0, are skipped.
</dd><dt><span class="term">
<span class="strong"><strong>--AF-tag</strong></span> <span class="emphasis"><em>TAG</em></span>
</span></dt><dd>
    use the specified INFO tag <span class="emphasis"><em>TAG</em></span> as an allele frequency estimate
    instead of the default AC and AN tags. Sites which do not have <span class="emphasis"><em>TAG</em></span>
    will be skipped.
</dd><dt><span class="term">
<span class="strong"><strong>--AF-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Read allele frequencies from a tab-delimited file containing
    the columns: CHROM\tPOS\tREF,ALT\tAF. The file can be compressed with
    <span class="strong"><strong>bgzip</strong></span> and indexed with tabix -s1 -b2 -e2.  Sites which are not present in
    the <span class="emphasis"><em>FILE</em></span> or have different reference or alternate allele will be skipped.
    Note that such a file can be easily created from a VCF using:
</dd></dl></div><pre class="screen">    bcftools query -f'%CHROM\t%POS\t%REF,%ALT\t%INFO/TAG\n' file.vcf | bgzip -c &gt; freqs.tab.gz</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-b, --buffer-size</strong></span> <span class="emphasis"><em>INT</em></span>[,<span class="emphasis"><em>INT</em></span>]
</span></dt><dd>
    when the entire many-sample file cannot fit into memory, a sliding
    buffer approach can be used. The first value is the number of sites
    to keep in memory. If negative, it is interpreted as the maximum
    memory to use, in MB. The second, optional, value sets the number
    of overlapping sites. The default overlap is set to roughly 1% of
    the buffer size.
</dd><dt><span class="term">
<span class="strong"><strong>-e, --estimate-AF</strong></span> <span class="emphasis"><em><span class="TAG">FILE</span></em></span>
</span></dt><dd>
    estimate the allele frequency by recalculating INFO/AC and INFO/AN on
    the fly, using the specified <span class="emphasis"><em>TAG</em></span> which can be either FORMAT/GT ("GT")
    or FORMAT/PL ("PL"). If <span class="emphasis"><em>TAG</em></span> is not given, "GT" is assumed.  Either all
    samples ("-") or samples listed in <span class="emphasis"><em>FILE</em></span> will be included. For example,
    use "PL,-" to estimate AF from FORMAT/PL of all samples.
    If neither <span class="strong"><strong>-e</strong></span> nor the other <span class="strong"><strong>--AF-…</strong></span> options are given, the allele frequency is
    estimated from AC and AN counts which are already present in the INFO field.
</dd><dt><span class="term">
<span class="strong"><strong>--exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-G, --GTs-only</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    use genotypes (FORMAT/GT fields) ignoring genotype likelihoods (FORMAT/PL),
    setting PL of unseen genotypes to <span class="emphasis"><em>FLOAT</em></span>. Safe value to use is 30 to
    account for GT errors.
</dd><dt><span class="term">
<span class="strong"><strong>--include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-I, --skip-indels</strong></span>
</span></dt><dd>
    skip indels as their genotypes are usually enriched for errors
</dd><dt><span class="term">
<span class="strong"><strong>-m, --genetic-map</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    genetic map in the format required also by IMPUTE2. Only the first and
    third column are used (position and Genetic_Map(cM)). The <span class="emphasis"><em>FILE</em></span> can
    chromosome name.
</dd><dt><span class="term">
<span class="strong"><strong>-M, --rec-rate</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    constant recombination rate per bp. In combination with <span class="strong"><strong>--genetic-map</strong></span>,
    the <span class="strong"><strong>--rec-rate</strong></span> parameter is interpreted differently, as <span class="emphasis"><em>FLOAT</em></span>-fold increase of
    transition probabilities, which allows the model to become more sensitive
    yet still account for recombination hotspots. Note that also the range
    of the values is therefore different in both cases: normally the
    parameter will be in the range (1e-3,1e-9) but with <span class="strong"><strong>--genetic-map</strong></span>
    it will be in the range (10,1000).
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    Write output to the <span class="emphasis"><em>FILE</em></span>, by default the output is printed on stdout
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>s</em></span>|<span class="emphasis"><em>r</em></span>[<span class="emphasis"><em>z</em></span>]
</span></dt><dd>
    Generate per-site output (<span class="emphasis"><em>s</em></span>) or per-region output (<span class="emphasis"><em>r</em></span>). By default
    both types are printed and the output is uncompressed. Add <span class="emphasis"><em>z</em></span> for
    a compressed output.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="HMM Options:"><a id="_hmm_options_2"></a><h4>HMM Options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-a, --hw-to-az</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    P(AZ|HW) transition probability from AZ (autozygous) to HW (Hardy-Weinberg) state
</dd><dt><span class="term">
<span class="strong"><strong>-H, --az-to-hw</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    P(HW|AZ) transition probability from HW to AZ state
</dd><dt><span class="term">
<span class="strong"><strong>-V, --viterbi-training</strong></span> <span class="emphasis"><em>FLOAT</em></span>
</span></dt><dd>
    estimate HMM parameters using Baum-Welch algorithm, using the convergence threshold
    <span class="emphasis"><em>FLOAT</em></span>, e.g. 1e-10 (experimental)
</dd></dl></div></div></div><div class="refsect2" title="bcftools sort [OPTIONS] file.bcf"><a id="sort"></a><h3>bcftools sort [<span class="emphasis"><em>OPTIONS</em></span>] file.bcf</h3><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-m, --max-mem</strong></span> <span class="emphasis"><em>FLOAT</em></span>[<span class="emphasis"><em>kMG</em></span>]
</span></dt><dd>
    Maximum memory to use. Approximate, affects the number of temporary files written
    to the disk. Note that if the command fails at this step because of too many open files,
    your system limit on the number of open files ("ulimit") may need to be increased.
</dd><dt><span class="term">
<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --temp-dir</strong></span> <span class="emphasis"><em>DIR</em></span>
</span></dt><dd>
    Use this directory to store temporary files
</dd></dl></div></div><div class="refsect2" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]"><a id="stats"></a><h3>bcftools stats [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>A.vcf.gz</em></span> [<span class="emphasis"><em>B.vcf.gz</em></span>]</h3><p>Parses VCF or BCF and produces text file stats which is suitable for machine
processing and can be plotted using <span class="strong"><strong><a class="link" href="#plot-vcfstats" title="plot-vcfstats [OPTIONS] file.vchk […]">plot-vcfstats</a></strong></span>.  When two files are given,
the program generates separate stats for intersection and the complements. By
default only sites are compared, <span class="strong"><strong>-s</strong></span>/<span class="strong"><strong>-S</strong></span> must given to include also sample
columns.
When one VCF file is specified on the command line, then stats by non-reference allele
frequency, depth distribution, stats by quality and per-sample counts, singleton stats,
etc. are printed.
When two VCF files are given, then stats such as concordance (Genotype concordance by
non-reference allele frequency, Genotype concordance by sample, Non-Reference Discordance)
and correlation are also printed. Per-site discordance (PSD) is also printed in <span class="strong"><strong>--verbose</strong></span> mode.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>--af-bins</strong></span> <span class="emphasis"><em>LIST</em></span>|<span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    comma separated list of allele frequency bins (e.g. 0.1,0.5,1)
    or a file listing the allele frequency bins one per line (e.g. 0.1\n0.5\n1)
</dd><dt><span class="term">
<span class="strong"><strong>--af-tag</strong></span> <span class="emphasis"><em>TAG</em></span>
</span></dt><dd>
    allele frequency INFO tag to use for binning. By default the allele frequency is
    estimated from AC/AN, if available, or directly from the genotypes (GT) if not.
</dd><dt><span class="term">
<span class="strong"><strong>-1, --1st-allele-only</strong></span>
</span></dt><dd>
    consider only the 1st alternate allele at multiallelic sites
</dd><dt><span class="term">
<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-d, --depth</strong></span> <span class="emphasis"><em>INT</em></span>,<span class="emphasis"><em>INT</em></span>,<span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    ranges of depth distribution: min, max, and size of the bin
</dd><dt><span class="term">
<span class="strong"><strong>--debug</strong></span>
</span></dt><dd>
    produce verbose per-site and per-sample output
</dd><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-E, --exons</strong></span> <span class="emphasis"><em>file.gz</em></span>
</span></dt><dd>
    tab-delimited file with exons for indel frameshifts statistics. The columns
    of the file are CHR, FROM, TO, with 1-based, inclusive, positions. The file
    is BGZF-compressed and indexed with tabix
</dd></dl></div><pre class="screen">    tabix -s1 -b2 -e3 file.gz</pre><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-F, --fasta-ref</strong></span> <span class="emphasis"><em>ref.fa</em></span>
</span></dt><dd>
    faidx indexed reference sequence file to determine INDEL context
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-I, --split-by-ID</strong></span>
</span></dt><dd>
    collect stats separately for sites which have the ID column set ("known
    sites") or which do not have the ID column set ("novel sites").
</dd><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-u, --user-tstv</strong></span> <span class="emphasis"><em>&lt;TAG[:min:max:n]&gt;</em></span>
</span></dt><dd>
    collect Ts/Tv stats for any tag using the given binning [0:1:100]
</dd><dt><span class="term">
<span class="strong"><strong>-v, --verbose</strong></span>
</span></dt><dd>
    produce verbose per-site and per-sample output
</dd></dl></div></div><div class="refsect2" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]"><a id="view"></a><h3>bcftools view [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span> [<span class="emphasis"><em>REGION</em></span> […]]</h3><p>View, subset and filter VCF or BCF files by position and filtering expression.
Convert between VCF and BCF. Former <span class="strong"><strong>bcftools subset</strong></span>.</p><div class="refsect3" title="Output options"><a id="_output_options_2"></a><h4>Output options</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-G, --drop-genotypes</strong></span>
</span></dt><dd>
    drop individual genotype information (after subsetting if <span class="strong"><strong>-s</strong></span> option is set)
</dd><dt><span class="term">
<span class="strong"><strong>-h, --header-only</strong></span>
</span></dt><dd>
    output the VCF header only
</dd><dt><span class="term">
<span class="strong"><strong>-H, --no-header</strong></span>
</span></dt><dd>
    suppress the header in VCF output
</dd><dt><span class="term">
<span class="strong"><strong>-l, --compression-level</strong></span> [<span class="emphasis"><em>0-9</em></span>]
</span></dt><dd>
    compression level. 0 stands for uncompressed, 1 for best speed and 9 for
    best compression.
</dd><dt><span class="term">
<span class="strong"><strong>--no-version</strong></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div><p><span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>:
    output file name. If not present, the default is to print to standard output (stdout).</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>--threads</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd></dl></div></div><div class="refsect3" title="Subset options:"><a id="_subset_options"></a><h4>Subset options:</h4><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-a, --trim-alt-alleles</strong></span>
</span></dt><dd>
    remove alleles not seen in the genotype fields from the ALT column. Note that if no alternate allele
    remains after trimming, the record itself is not removed but ALT is set to ".".
    If the option <span class="strong"><strong>-s</strong></span> or <span class="strong"><strong>-S</strong></span> is given, removes alleles not seen in the subset.
    INFO and FORMAT tags declared as Type=A, G or R will be trimmed as well.
</dd><dt><span class="term">
<span class="strong"><strong>--force-samples</strong></span>
</span></dt><dd>
    only warn about unknown subset samples
</dd><dt><span class="term">
<span class="strong"><strong>-I, --no-update</strong></span>
</span></dt><dd>
    do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)
</dd><dt><span class="term">
<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. Note that it is possible to create
    multiple subsets simultaneously using the <span class="strong"><strong>split</strong></span> plugin.
</dd><dt><span class="term">
<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. Note that it is possible to create
    multiple subsets simultaneously using the <span class="strong"><strong>split</strong></span> plugin.
</dd></dl></div></div><div class="refsect3" title="Filter options:"><a id="_filter_options"></a><h4>Filter options:</h4><p>Note that filter options below dealing with counting the number of alleles
will, for speed, first check for the values of AC and AN in the INFO column to
avoid parsing all the genotype (FORMAT/GT) fields in the VCF. This means
that a filter like <span class="emphasis"><em>--min-af 0.1</em></span> will be calculated from INFO/AC and INFO/AN
when available or FORMAT/GT otherwise. However, it will not attempt to use any other existing
field, like INFO/AF for example. For that, use <span class="emphasis"><em>--exclude AF&lt;0.1</em></span> instead.</p><p>Also note that one must be careful when sample subsetting and filtering is performed in a single command
because the order of internal operations can influence the result. For example, the <span class="strong"><strong>-i/-e</strong></span> filtering
is performed before sample removal, but the <span class="strong"><strong>-P</strong></span> filtering is performed after,
and some are inherently ambiguous, for example allele counts can be taken from the INFO
column when present but calculated on the fly when absent. Therefore it is strongly recommended to spell out the
required order explicitly by separating such commands into two steps. (Make sure to use the <span class="strong"><strong>-O u</strong></span> option
when piping!)</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-c, --min-ac</strong></span> <span class="emphasis"><em>INT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|<span class="emphasis"><em>:major</em></span>|:'nonmajor']
</span></dt><dd>
    minimum allele count (INFO/AC) of sites to be printed.
    Specifying the type of allele is optional and can be set to
    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
</dd><dt><span class="term">
<span class="strong"><strong>-C, --max-ac</strong></span> <span class="emphasis"><em>INT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|:'major'|:'nonmajor']
</span></dt><dd>
    maximum allele count (INFO/AC) of sites to be printed.
    Specifying the type of allele is optional and can be set to
    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
</dd><dt><span class="term">
<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
</span></dt><dd>
    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
</dd><dt><span class="term">
<span class="strong"><strong>-g, --genotype</strong></span> [^][<span class="emphasis"><em>hom</em></span>|<span class="emphasis"><em>het</em></span>|<span class="emphasis"><em>miss</em></span>]
</span></dt><dd>
    include only sites with one or more homozygous (<span class="emphasis"><em>hom</em></span>), heterozygous
    (<span class="emphasis"><em>het</em></span>) or missing (<span class="emphasis"><em>miss</em></span>) genotypes. When prefixed with <span class="emphasis"><em>^</em></span>, the logic
    is reversed; thus <span class="emphasis"><em>^het</em></span> excludes sites with heterozygous genotypes.
</dd><dt><span class="term">
<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
</span></dt><dd>
    include sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-k, --known</strong></span>
</span></dt><dd>
    print known sites only (ID column is not ".")
</dd><dt><span class="term">
<span class="strong"><strong>-m, --min-alleles</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    print sites with at least <span class="emphasis"><em>INT</em></span> alleles listed in REF and ALT columns
</dd><dt><span class="term">
<span class="strong"><strong>-M, --max-alleles</strong></span> <span class="emphasis"><em>INT</em></span>
</span></dt><dd>
    print sites with at most <span class="emphasis"><em>INT</em></span> alleles listed in REF and ALT columns.
    Use <span class="strong"><strong>-m2 -M2 -v snps</strong></span> to only view biallelic SNPs.
</dd><dt><span class="term">
<span class="strong"><strong>-n, --novel</strong></span>
</span></dt><dd>
    print novel sites only (ID column is ".")
</dd><dt><span class="term">
<span class="strong"><strong>-p, --phased</strong></span>
</span></dt><dd>
    print sites where all samples are phased. Haploid genotypes are
    considered phased. Missing genotypes considered unphased unless the
    phased bit is set.
</dd><dt><span class="term">
<span class="strong"><strong>-P, --exclude-phased</strong></span>
</span></dt><dd>
    exclude sites where all samples are phased
</dd><dt><span class="term">
<span class="strong"><strong>-q, --min-af</strong></span> <span class="emphasis"><em>FLOAT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|<span class="emphasis"><em>:major</em></span>|<span class="emphasis"><em>:nonmajor</em></span>]
</span></dt><dd>
    minimum allele frequency (INFO/AC / INFO/AN) of sites to be printed.
    Specifying the type of allele is optional and can be set to
    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
</dd><dt><span class="term">
<span class="strong"><strong>-Q, --max-af</strong></span> <span class="emphasis"><em>FLOAT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|<span class="emphasis"><em>:major</em></span>|<span class="emphasis"><em>:nonmajor</em></span>]
</span></dt><dd>
    maximum allele frequency (INFO/AC / INFO/AN) of sites to be printed.
    Specifying the type of allele is optional and can be set to
    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
</dd><dt><span class="term">
<span class="strong"><strong>-u, --uncalled</strong></span>
</span></dt><dd>
    print sites without a called genotype
</dd><dt><span class="term">
<span class="strong"><strong>-U, --exclude-uncalled</strong></span>
</span></dt><dd>
    exclude sites without a called genotype
</dd><dt><span class="term">
<span class="strong"><strong>-v, --types</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>mnps</em></span>|<span class="emphasis"><em>other</em></span>
</span></dt><dd>
    comma-separated list of variant types to select. Site is selected if
    any of the ALT alleles is of the type requested. Types are determined
    by comparing the REF and ALT alleles in the VCF record not INFO tags
    like INFO/INDEL or INFO/VT. Use <span class="strong"><strong>--include</strong></span> to select based on INFO
    tags.
</dd><dt><span class="term">
<span class="strong"><strong>-V, --exclude-types</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>mnps</em></span>|<span class="emphasis"><em>ref</em></span>|<span class="emphasis"><em>bnd</em></span>|<span class="emphasis"><em>other</em></span>
</span></dt><dd>
    comma-separated list of variant types to exclude. Site is excluded if
    any of the ALT alleles is of the type requested. Types are determined
    by comparing the REF and ALT alleles in the VCF record not INFO tags
    like INFO/INDEL or INFO/VT. Use <span class="strong"><strong>--exclude</strong></span> to exclude based on INFO tags.
</dd><dt><span class="term">
<span class="strong"><strong>-x, --private</strong></span>
</span></dt><dd>
    print sites where only the subset samples carry an non-reference allele.
    Requires <span class="strong"><strong>--samples</strong></span> or <span class="strong"><strong>--samples-file</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-X, --exclude-private</strong></span>
</span></dt><dd>
    exclude sites where only the subset samples carry an non-reference allele
</dd></dl></div></div></div><div class="refsect2" title="bcftools help [COMMAND] | bcftools --help [COMMAND]"><a id="help"></a><h3>bcftools help [<span class="emphasis"><em>COMMAND</em></span>] | bcftools --help [<span class="emphasis"><em>COMMAND</em></span>]</h3><p>Display  a  brief usage message listing the bcftools commands available.
If the name of a command is also given, e.g., bcftools help view, the detailed
usage message for that particular command is displayed.</p></div><div class="refsect2" title="bcftools [--version|-v]"><a id="version"></a><h3>bcftools [<span class="emphasis"><em>--version</em></span>|<span class="emphasis"><em>-v</em></span>]</h3><p>Display the version numbers and copyright information for bcftools and the
important libraries used by bcftools.</p></div><div class="refsect2" title="bcftools [--version-only]"><a id="version-only"></a><h3>bcftools [<span class="emphasis"><em>--version-only</em></span>]</h3><p>Display the full bcftools version number in a machine-readable format.</p></div></div><div class="refsect1" title="EXPRESSIONS"><a id="expressions"></a><h2>EXPRESSIONS</h2><p>These filtering expressions are accepted by most of the commands.</p><div class="itemizedlist" title="Valid expressions may contain:"><p class="title"><strong>Valid expressions may contain:</strong></p><ul class="itemizedlist" type="disc"><li class="listitem"><p class="simpara">
numerical constants, string constants, file names (this is currently
  supported only to filter by the ID column)
</p><pre class="literallayout">1, 1.0, 1e-4
"String"
@file_name</pre></li><li class="listitem"><p class="simpara">
arithmetic operators
</p><pre class="literallayout">+,*,-,/</pre></li><li class="listitem"><p class="simpara">
comparison operators
</p><pre class="literallayout">== (same as =), &gt;, &gt;=, &lt;=, &lt;, !=</pre></li><li class="listitem"><p class="simpara">
regex operators "~" and its negation "!~". The expressions are case sensitive unless "/i" is added.
</p><pre class="literallayout">INFO/HAYSTACK ~ "needle"
INFO/HAYSTACK ~ "NEEDless/i"</pre></li><li class="listitem"><p class="simpara">
parentheses
</p><pre class="literallayout">(, )</pre></li><li class="listitem"><p class="simpara">
logical operators. See also the examples below and the <a class="ulink" href="http://samtools.github.io/bcftools/howtos/filtering.html" target="_top">filtering tutorial</a>
about the distinction between "&amp;&amp;" vs "&amp;" and "||" vs "|".
</p><pre class="literallayout">&amp;&amp;,  &amp;, ||,  |</pre></li><li class="listitem"><p class="simpara">
INFO tags, FORMAT tags, column names
</p><pre class="literallayout">INFO/DP or DP
FORMAT/DV, FMT/DV, or DV
FILTER, QUAL, ID, CHROM, POS, REF, ALT[0]</pre></li><li class="listitem"><p class="simpara">
starting with 1.11, the FILTER column can be queried as follows:
</p><pre class="literallayout">FILTER="PASS"
FILTER="A"          .. exact match, for example "A;B" does not pass
FILTER!="A"         .. exact match, for example "A;B" does pass
FILTER~"A"          .. both "A" and "A;B" pass
FILTER!~"A"         .. neither "A" nor "A;B" pass</pre></li><li class="listitem"><p class="simpara">
1 (or 0) to test the presence (or absence) of a flag
</p><pre class="literallayout">FlagA=1 &amp;&amp; FlagB=0</pre></li><li class="listitem"><p class="simpara">
"." to test missing values
</p><pre class="literallayout">DP=".", DP!=".", ALT="."</pre></li><li class="listitem"><p class="simpara">
missing genotypes can be matched regardless of phase and ploidy (".|.", "./.", ".")
using these expressions
</p><pre class="literallayout">GT~"\.", GT!~"\."</pre></li><li class="listitem"><p class="simpara">
missing genotypes can be matched including the phase and ploidy (".|.", "./.", ".")
using these expressions
</p><pre class="literallayout">GT=".|.", GT="./.", GT="."</pre></li><li class="listitem"><p class="simpara">
sample genotype: reference (haploid or diploid), alternate (hom or het,
haploid or diploid), missing genotype, homozygous, heterozygous, haploid,
ref-ref hom, alt-alt hom, ref-alt het, alt-alt het, haploid ref, haploid alt
(case-insensitive)
</p><pre class="literallayout">GT="ref"
GT="alt"
GT="mis"
GT="hom"
GT="het"
GT="hap"
GT="RR"
GT="AA"
GT="RA" or GT="AR"
GT="Aa" or GT="aA"
GT="R"
GT="A"</pre></li><li class="listitem"><p class="simpara">
TYPE for variant type in REF,ALT columns (indel,snp,mnp,ref,bnd,other,overlap). Use the regex
operator "\~" to require at least one allele of the given type or the equal sign "="
to require that all alleles are of the given type. Compare
</p><pre class="literallayout">TYPE="snp"
TYPE~"snp"
TYPE!="snp"
TYPE!~"snp"</pre></li><li class="listitem"><p class="simpara">
array subscripts (0-based), "*" for any element, "-" to indicate a range. Note that
for querying FORMAT vectors, the colon ":" can be used to select a sample and an
element of the vector, as shown in the examples below
</p><pre class="literallayout">INFO/AF[0] &gt; 0.3             .. first AF value bigger than 0.3
FORMAT/AD[0:0] &gt; 30          .. first AD value of the first sample bigger than 30
FORMAT/AD[0:1]               .. first sample, second AD value
FORMAT/AD[1:0]               .. second sample, first AD value
DP4[*] == 0                  .. any DP4 value
FORMAT/DP[0]   &gt; 30          .. DP of the first sample bigger than 30
FORMAT/DP[1-3] &gt; 10          .. samples 2-4
FORMAT/DP[1-]  &lt; 7           .. all samples but the first
FORMAT/DP[0,2-4] &gt; 20        .. samples 1, 3-5
FORMAT/AD[0:1]               .. first sample, second AD field
FORMAT/AD[0:*], AD[0:] or AD[0] .. first sample, any AD field
FORMAT/AD[*:1] or AD[:1]        .. any sample, second AD field
(DP4[0]+DP4[1])/(DP4[2]+DP4[3]) &gt; 0.3
CSQ[*] ~ "missense_variant.*deleterious"</pre></li><li class="listitem"><p class="simpara">
with many samples it can be more practical to provide a file with sample names,
one sample name per line
</p><pre class="literallayout">GT[@samples.txt]="het" &amp; binom(AD)&lt;0.01</pre></li><li class="listitem"><p class="simpara">
function on FORMAT tags (over samples) and INFO tags (over vector fields):
  maximum; minimum; arithmetic mean (AVG is synonymous with MEAN); median;
  standard deviation from mean; sum; string length; absolute value; number of
  elements:
</p><pre class="literallayout">MAX, MIN, AVG, MEAN, MEDIAN, STDEV, SUM, STRLEN, ABS, COUNT</pre><p class="simpara">Note that functions above evaluate to a single value across all samples and
are intended to select sites, not samples, even when applied on FORMAT tags.
However, when prefixed with SMPL_ (or "s" for brevity, e.g. SMPL_MAX or sMAX),
they will evaluate to a vector of per-sample values when applied on FORMAT tags:</p><pre class="literallayout">SMPL_MAX, SMPL_MIN, SMPL_AVG, SMPL_MEAN, SMPL_MEDIAN, SMPL_STDEV, SMPL_SUM,
sMAX, sMIN, sAVG, sMEAN, sMEDIAN, sSTDEV, sSUM</pre></li><li class="listitem"><p class="simpara">
two-tailed binomial test. Note that for N=0 the test evaluates to a missing value
  and when FORMAT/GT is used to determine the vector indices, it evaluates to 1 for
  homozygous genotypes.
</p><pre class="literallayout">binom(FMT/AD)                .. GT can be used to determine the correct index
binom(AD[0],AD[1])           .. or the fields can be given explicitly
phred(binom())               .. the same as binom but phred-scaled</pre></li><li class="listitem"><p class="simpara">
variables calculated on the fly if not present: number of alternate alleles;
number of samples; count of alternate alleles; minor allele count (similar to
AC but is always smaller than 0.5); frequency of alternate alleles (AF=AC/AN);
frequency of minor alleles (MAF=MAC/AN); number of alleles in called genotypes;
number of samples with missing genotype; fraction of samples with missing genotype;
indel length (deletions negative, insertions positive)
</p><pre class="literallayout">N_ALT, N_SAMPLES, AC, MAC, AF, MAF, AN, N_MISSING, F_MISSING, ILEN</pre></li><li class="listitem"><p class="simpara">
the number (N_PASS) or fraction (F_PASS) of samples which pass the expression
</p><pre class="literallayout">N_PASS(GQ&gt;90 &amp; GT!="mis") &gt; 90
F_PASS(GQ&gt;90 &amp; GT!="mis") &gt; 0.9</pre></li><li class="listitem"><p class="simpara">
custom perl filtering. Note that this command is not compiled in by default, see
the section <span class="strong"><strong>Optional Compilation with Perl</strong></span> in the INSTALL file for help
and misc/demo-flt.pl for a working example. The demo defined the perl subroutine
"severity" which can be invoked from the command line as follows:
</p><pre class="literallayout">perl:path/to/script.pl; perl.severity(INFO/CSQ) &gt; 3</pre></li></ul></div><div class="itemizedlist" title="Notes:"><p class="title"><strong>Notes:</strong></p><ul class="itemizedlist" type="disc"><li class="listitem">
String comparisons and regular expressions are case-insensitive
</li><li class="listitem"><p class="simpara">
Comma in strings is interpreted as a separator and when multiple values are compared, the OR logic is used.
  Consequently, the following two expressions are equivalent but not the third:
</p><pre class="literallayout">-i 'TAG="hello,world"'
-i 'TAG="hello" || TAG="world"'
-i 'TAG="hello" &amp;&amp; TAG="world"'</pre></li><li class="listitem">
Variables and function names are case-insensitive, but not tag names. For example,
"qual" can be used instead of "QUAL", "strlen()" instead of "STRLEN()" , but
not "dp" instead of "DP".
</li><li class="listitem"><p class="simpara">
When querying multiple values, all elements are tested and the OR logic is
used on the result. For example, when querying "TAG=1,2,3,4", it will be evaluated as follows:
</p><pre class="literallayout">-i 'TAG[*]=1'   .. true, the record will be printed
-i 'TAG[*]!=1'  .. true
-e 'TAG[*]=1'   .. false, the record will be discarded
-e 'TAG[*]!=1'  .. false
-i 'TAG[0]=1'   .. true
-i 'TAG[0]!=1'  .. false
-e 'TAG[0]=1'   .. false
-e 'TAG[0]!=1'  .. true</pre></li></ul></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="literallayout">MIN(DV)&gt;5       .. selects the whole site, evaluates min across all values and samples</pre><pre class="literallayout">SMPL_MIN(DV)&gt;5  .. selects matching samples, evaluates within samples</pre><pre class="literallayout">MIN(DV/DP)&gt;0.3</pre><pre class="literallayout">MIN(DP)&gt;10 &amp; MIN(DV)&gt;3</pre><pre class="literallayout">FMT/DP&gt;10  &amp; FMT/GQ&gt;10 .. both conditions must be satisfied within one sample</pre><pre class="literallayout">FMT/DP&gt;10 &amp;&amp; FMT/GQ&gt;10 .. the conditions can be satisfied in different samples</pre><pre class="literallayout">QUAL&gt;10 |  FMT/GQ&gt;10   .. true for sites with QUAL&gt;10 or a sample with GQ&gt;10, but selects only samples with GQ&gt;10</pre><pre class="literallayout">QUAL&gt;10 || FMT/GQ&gt;10   .. true for sites with QUAL&gt;10 or a sample with GQ&gt;10, plus selects all samples at such sites</pre><pre class="literallayout">TYPE="snp" &amp;&amp; QUAL&gt;=10 &amp;&amp; (DP4[2]+DP4[3] &gt; 2)</pre><pre class="literallayout">COUNT(GT="hom")=0      .. no homozygous genotypes at the site</pre><pre class="literallayout">AVG(GQ)&gt;50             .. average (arithmetic mean) of genotype qualities bigger than 50</pre><pre class="literallayout">ID=@file       .. selects lines with ID present in the file</pre><pre class="literallayout">ID!=@~/file    .. skip lines with ID present in the ~/file</pre><pre class="literallayout">MAF[0]&lt;0.05    .. select rare variants at 5% cutoff</pre><pre class="literallayout">POS&gt;=100   .. restrict your range query, e.g. 20:100-200 to strictly sites with POS in that range.</pre><p><span class="strong"><strong>Shell expansion:</strong></span></p><p>Note that expressions must often be quoted because some characters
have special meaning in the shell.
An example of expression enclosed in single quotes which cause
that the whole expression is passed to the program as intended:</p><pre class="literallayout">bcftools view -i '%ID!="." &amp; MAF[0]&lt;0.01'</pre><p>Please refer to the documentation of your shell for details.</p></div><div class="refsect1" title="SCRIPTS AND OPTIONS"><a id="_scripts_and_options"></a><h2>SCRIPTS AND OPTIONS</h2><div class="refsect2" title="plot-vcfstats [OPTIONS] file.vchk […]"><a id="plot-vcfstats"></a><h3>plot-vcfstats [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vchk</em></span> […]</h3><p>Script for processing output of <span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">bcftools stats</a></strong></span>. It can merge
results from multiple outputs (useful when running the stats for each
chromosome separately), plots graphs and creates a PDF presentation.</p><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>-m, --merge</strong></span>
</span></dt><dd>
    Merge vcfstats files to STDOUT, skip plotting.
</dd><dt><span class="term">
<span class="strong"><strong>-p, --prefix</strong></span> <span class="emphasis"><em>DIR</em></span>
</span></dt><dd>
    The output directory. This directory will be created if it does not exist.
</dd><dt><span class="term">
<span class="strong"><strong>-P, --no-PDF</strong></span>
</span></dt><dd>
    Skip the PDF creation step.
</dd><dt><span class="term">
<span class="strong"><strong>-r, --rasterize</strong></span>
</span></dt><dd>
    Rasterize PDF images for faster rendering. This is the default and the opposite of <span class="strong"><strong>-v, --vectors</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-s, --sample-names</strong></span>
</span></dt><dd>
    Use sample names for xticks rather than numeric IDs.
</dd><dt><span class="term">
<span class="strong"><strong>-t, --title</strong></span> <span class="emphasis"><em>STRING</em></span>
</span></dt><dd>
    Identify files by these titles in plots. The option can be given multiple
    times, for each ID in the <span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">bcftools stats</a></strong></span> output. If not
    present, the script will use abbreviated source file names for the titles.
</dd><dt><span class="term">
<span class="strong"><strong>-v, --vectors</strong></span>
</span></dt><dd>
    Generate vector graphics for PDF images, the opposite of <span class="strong"><strong>-r, --rasterize</strong></span>.
</dd><dt><span class="term">
<span class="strong"><strong>-T, --main-title</strong></span> <span class="emphasis"><em>STRING</em></span>
</span></dt><dd>
    Main title for the PDF.
</dd></dl></div><p><span class="strong"><strong>Example:</strong></span></p><pre class="literallayout"># Generate the stats
bcftools stats -s - &gt; file.vchk</pre><pre class="literallayout"># Plot the stats
plot-vcfstats -p outdir file.vchk</pre><pre class="literallayout"># The final looks can be customized by editing the generated
# 'outdir/plot.py' script and re-running manually
cd outdir &amp;&amp; python plot.py &amp;&amp; pdflatex summary.tex</pre></div></div><div class="refsect1" title="PERFORMANCE"><a id="_performance"></a><h2>PERFORMANCE</h2><p>HTSlib was designed with BCF format in mind. When parsing VCF files, all records
are internally converted into BCF representation. Simple operations, like removing
a single column from a VCF file, can be therefore done much faster with standard
UNIX commands, such as <span class="strong"><strong>awk</strong></span> or <span class="strong"><strong>cut</strong></span>.
Therefore it is recommended to use BCF as input/output format whenever possible to avoid
large overhead of the VCF → BCF → VCF conversion.</p></div><div class="refsect1" title="BUGS"><a id="_bugs"></a><h2>BUGS</h2><p>Please report any bugs you encounter on the github website: <a class="ulink" href="http://github.com/samtools/bcftools" target="_top">http://github.com/samtools/bcftools</a></p></div><div class="refsect1" title="AUTHORS"><a id="_authors"></a><h2>AUTHORS</h2><p>Heng Li from the Sanger Institute wrote the original C version of htslib,
samtools and bcftools. Bob Handsaker from the Broad Institute implemented the
BGZF library. Petr Danecek, Shane McCarthy and John Marshall are  maintaining
and further developing bcftools.  Many other people contributed to the program
and to the file format specifications, both directly and indirectly by
providing patches, testing and reporting bugs. We thank them all.</p></div><div class="refsect1" title="RESOURCES"><a id="_resources"></a><h2>RESOURCES</h2><p>BCFtools GitHub website: <a class="ulink" href="http://github.com/samtools/bcftools" target="_top">http://github.com/samtools/bcftools</a></p><p>Samtools GitHub website: <a class="ulink" href="http://github.com/samtools/samtools" target="_top">http://github.com/samtools/samtools</a></p><p>HTSlib GitHub website: <a class="ulink" href="http://github.com/samtools/htslib" target="_top">http://github.com/samtools/htslib</a></p><p>File format specifications: <a class="ulink" href="http://samtools.github.io/hts-specs" target="_top">http://samtools.github.io/hts-specs</a></p><p>BCFtools documentation: <a class="ulink" href="http://samtools.github.io/bcftools" target="_top">http://samtools.github.io/bcftools</a></p><p>BCFtools wiki page: <a class="ulink" href="https://github.com/samtools/bcftools/wiki" target="_top">https://github.com/samtools/bcftools/wiki</a></p></div><div class="refsect1" title="COPYING"><a id="_copying"></a><h2>COPYING</h2><p>The MIT/Expat License or GPL License, see the LICENSE document for details.
Copyright (c) Genome Research Ltd.</p></div></div></body></html>
